Skip to content

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

*) closing stream correctly

thelidb3ed757282e
diff --git a/source/de/anomic/plasma/parser/AbstractParser.java b/source/de/anomic/plasma/parser/AbstractParser.java
index 696448a56..f7ed3ab35 100644
--- a/source/de/anomic/plasma/parser/AbstractParser.java
+++ b/source/de/anomic/plasma/parser/AbstractParser.java
@@ -93,10 +93,23 @@ public abstract class AbstractParser implements Parser{
*
* @see de.anomic.plasma.parser.Parser#parse(java.net.URL, java.lang.String, byte[])
*/
- public plasmaParserDocument parse(URL location, String mimeType,
- byte[] source) throws ParserException {
- ByteArrayInputStream contentInputStream = new ByteArrayInputStream(source);
- return this.parse(location,mimeType,contentInputStream);
+ public plasmaParserDocument parse(
+ URL location,
+ String mimeType,
+ byte[] source
+ ) throws ParserException {
+ ByteArrayInputStream contentInputStream = null;
+ try {
+ contentInputStream = new ByteArrayInputStream(source);
+ return this.parse(location,mimeType,contentInputStream);
+ } finally {
+ if (contentInputStream != null) {
+ try {
+ contentInputStream.close();
+ contentInputStream = null;
+ } catch (Exception e){}
+ }
+ }
}
/**