Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

throwing an exception again in FileUtils.copy(reader, writer) OOMs could occour here and should not be ignored

sixcooler9170a434edf3
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;
}