Author: dogacan
Date: Wed Sep 26 23:49:26 2007
New Revision: 579922

URL: http://svn.apache.org/viewvc?rev=579922&view=rev
Log:
Java 5 compatibility fix for NUTCH-25. Contributed by Ned Rockson.

Modified:
    
lucene/nutch/trunk/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/HtmlParser.java

Modified: 
lucene/nutch/trunk/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/HtmlParser.java
URL: 
http://svn.apache.org/viewvc/lucene/nutch/trunk/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/HtmlParser.java?rev=579922&r1=579921&r2=579922&view=diff
==============================================================================
--- 
lucene/nutch/trunk/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/HtmlParser.java
 (original)
+++ 
lucene/nutch/trunk/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/HtmlParser.java
 Wed Sep 26 23:49:26 2007
@@ -81,7 +81,14 @@
     // to just inflate each byte to a 16-bit value by padding. 
     // For instance, the sequence {0x41, 0x82, 0xb7} will be turned into 
     // {U+0041, U+0082, U+00B7}. 
-    String str = new String(content, 0, length, Charset.forName("ASCII"));
+    String str = "";
+    try {
+      str = new String(content, 0, length,
+                       Charset.forName("ASCII").toString());
+    } catch (UnsupportedEncodingException e) {
+      // code should never come here, but just in case... 
+      return null;
+    }
 
     Matcher metaMatcher = metaPattern.matcher(str);
     String encoding = null;


Reply via email to