Skip to content

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

try to remove hung swf parser from queue

lotusc695c7f5126b
diff --git a/source/de/anomic/plasma/parser/swf/swfParser.java b/source/de/anomic/plasma/parser/swf/swfParser.java
index 695f6ece6..03da260ca 100644
--- a/source/de/anomic/plasma/parser/swf/swfParser.java
+++ b/source/de/anomic/plasma/parser/swf/swfParser.java
@@ -72,6 +72,8 @@ public class swfParser extends AbstractParser implements Parser {
*/
public plasmaParserDocument parse(final yacyURL location, final String mimeType, final String charset, final InputStream source) throws ParserException, InterruptedException {
+ plasmaParserDocument theDoc = null;
+
try {
final SWF2HTML swf2html = new SWF2HTML();
String contents = "";
@@ -109,7 +111,7 @@ public class swfParser extends AbstractParser implements Parser {
}
// As the result of parsing this function must return a plasmaParserDocument object
- final plasmaParserDocument theDoc = new plasmaParserDocument(
+ theDoc = new plasmaParserDocument(
location, // url of the source document
mimeType, // the documents mime type
"UTF-8", // charset of the document text
@@ -134,6 +136,13 @@ public class swfParser extends AbstractParser implements Parser {
final String errorMsg = "Unable to parse the swf document '" + location + "':" + e.getMessage();
this.theLogger.logSevere(errorMsg);
throw new ParserException(errorMsg, location);
+ } finally {
+ if (theDoc == null) {
+ // if an unexpected error occures just log the error and raise a new ParserException
+ final String errorMsg = "Unable to parse the swf document '" + location + "': possibly out of memory";
+ this.theLogger.logSevere(errorMsg);
+ throw new ParserException(errorMsg, location);
+ }
}
}