From 9170a434edf3a36062d26b42b6f53c49c04668c6 Mon Sep 17 00:00:00 2001 From: sixcooler Date: Mon, 1 Aug 2011 23:32:58 +0000 Subject: [PATCH] throwing an exception again in FileUtils.copy(reader, writer) OOMs could occour here and should not be ignored git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7858 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/net/yacy/document/parser/htmlParser.java | 4 +++- source/net/yacy/kelondro/util/FileUtils.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/net/yacy/document/parser/htmlParser.java b/source/net/yacy/document/parser/htmlParser.java index a73d33c70..dc2dc966b 100644 --- a/source/net/yacy/document/parser/htmlParser.java +++ b/source/net/yacy/document/parser/htmlParser.java @@ -136,9 +136,11 @@ public class htmlParser extends AbstractParser implements Parser { final TransformerWriter writer = new TransformerWriter(null,null,scraper,null,false); try { FileUtils.copy(sourceStream, writer, c); - writer.close(); } catch (IOException e) { throw new Parser.Failure("IO error:" + e.getMessage(), location); + } finally { + sourceStream.close(); + writer.close(); } //OutputStream hfos = new htmlFilterOutputStream(null, scraper, null, false); //serverFileUtils.copy(sourceFile, hfos); diff --git a/source/net/yacy/kelondro/util/FileUtils.java b/source/net/yacy/kelondro/util/FileUtils.java index d79fe40ce..6a6e9fde0 100644 --- a/source/net/yacy/kelondro/util/FileUtils.java +++ b/source/net/yacy/kelondro/util/FileUtils.java @@ -159,7 +159,7 @@ public final class FileUtils { assert e != null; // an "sun.io.MalformedInputException: Missing byte-order mark" - exception may occur here //Log.logException(e); - //throw new IOException(e == null ? "null" : e.getMessage() == null ? e.toString() : e.getMessage(), e); + throw new IOException(e == null ? "null" : e.getMessage() == null ? e.toString() : e.getMessage(), e); } return count; }