Apache Nutch is an extensible and scalable web crawler
NUTCH-91 - empty encoding causes exception. (Michael Nebel)
Piotr Kosiorowski9fd371ca329e
diff --git a/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/HtmlParser.java b/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/HtmlParser.javaindex 77708fe3b..e94c98205 100644--- a/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/HtmlParser.java+++ b/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/HtmlParser.java@@ -120,7 +120,7 @@ public class HtmlParser implements Parser {InputSource input = new InputSource(new ByteArrayInputStream(contentInOctets));String contentType = content.getMetadata().get(Response.CONTENT_TYPE);String encoding = StringUtil.parseCharacterEncoding(contentType);- if (encoding!=null) {+ if ((encoding != null) && !("".equals(encoding))) {metadata.set(Metadata.ORIGINAL_CHAR_ENCODING, encoding);if ((encoding = StringUtil.resolveEncodingAlias(encoding)) != null) {metadata.set(Metadata.CHAR_ENCODING_FOR_CONVERSION, encoding);@@ -129,7 +129,7 @@ public class HtmlParser implements Parser {}// sniff out 'charset' value from the beginning of a document- if (encoding == null) {+ if ((encoding == null) || ("".equals(encoding))) {encoding = sniffCharacterEncoding(contentInOctets);if (encoding!=null) {metadata.set(Metadata.ORIGINAL_CHAR_ENCODING, encoding);