diff --git a/source/de/anomic/search/Switchboard.java b/source/de/anomic/search/Switchboard.java index 5e38114e4..b539d15b7 100644 --- a/source/de/anomic/search/Switchboard.java +++ b/source/de/anomic/search/Switchboard.java @@ -1599,7 +1599,7 @@ public final class Switchboard extends serverSwitch { document = TextParser.parseSource(response.url(), response.getMimeType(), response.getCharacterEncoding(), b); assert(document != null) : "Unexpected error. Parser returned null."; } catch (final ParserException e) { - this.log.logWarning("Unable to parse the resource '" + response.url() + "'. " + e.getMessage(), e); + this.log.logWarning("Unable to parse the resource '" + response.url() + "'. " + e.getMessage()); addURLtoErrorDB(response.url(), response.referrerHash(), response.initiator(), response.name(), e.getMessage()); if (document != null) { document.close(); diff --git a/source/net/yacy/document/TextParser.java b/source/net/yacy/document/TextParser.java index 53de21c44..4f211e7d7 100644 --- a/source/net/yacy/document/TextParser.java +++ b/source/net/yacy/document/TextParser.java @@ -214,13 +214,15 @@ public final class TextParser { mimeType = normalizeMimeType(mimeType); final String fileExt = location.getFileExtension(); final String documentCharset = htmlParser.patchCharsetEncoding(charset); - List idioms = idiomParser(location, mimeType); - - if (idioms.isEmpty()) { - final String errorMsg = "No parser available to parse extension '" + location.getFileExtension() + "' or mimetype '" + mimeType + "'"; - log.logInfo("Unable to parse '" + location + "'. " + errorMsg); + List idioms = null; + try { + idioms = idiomParser(location, mimeType); + } catch (ParserException e) { + final String errorMsg = "Parser Failure for extension '" + location.getFileExtension() + "' or mimetype '" + mimeType + "': " + e.getMessage(); + log.logWarning(errorMsg); throw new ParserException(errorMsg, location); } + assert !idioms.isEmpty(); if (log.isFine()) log.logInfo("Parsing " + location + " with mimeType '" + mimeType + "' and file extension '" + fileExt + "'."); @@ -310,6 +312,9 @@ public final class TextParser { idiom = mime2parser.get(mimeType2); if (idiom != null && !idioms.contains(idiom)) idioms.add(idiom); + // finall check if we found any parser + if (idioms.isEmpty()) throw new ParserException("no parser found for extension '" + ext + "' and mime type '" + mimeType1 + "'", url); + return idioms; }