manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1571121 - /manifoldcf/trunk/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java
Date Mon, 24 Feb 2014 00:45:19 GMT
Author: kwright
Date: Mon Feb 24 00:45:18 2014
New Revision: 1571121

URL: http://svn.apache.org/r1571121
Log:
Catch content-type parse exception and deal with it locally

Modified:
    manifoldcf/trunk/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java

Modified: manifoldcf/trunk/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java?rev=1571121&r1=1571120&r2=1571121&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java
(original)
+++ manifoldcf/trunk/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java
Mon Feb 24 00:45:18 2014
@@ -69,6 +69,7 @@ import org.apache.http.conn.ConnectTimeo
 import org.apache.http.client.CircularRedirectException;
 import org.apache.http.NoHttpResponseException;
 import org.apache.http.HttpException;
+import org.apache.http.ParseException;
 
 import java.nio.charset.Charset;
 import java.util.*;
@@ -4649,12 +4650,19 @@ public class WikiConnector extends org.a
       InputStream is = entity.getContent();
       try
       {
-        ContentType contentType = ContentType.getOrDefault(entity);
         Charset charSet;
-        if (contentType == null)
-          charSet = UTF_8;
-        else
-          charSet = contentType.getCharset();
+        try
+        {
+          ContentType contentType = ContentType.getOrDefault(entity);
+          if (contentType == null)
+            charSet = UTF_8;
+          else
+            charSet = contentType.getCharset();
+        }
+        catch (ParseException e)
+        {
+          charSet = null;
+        }
         char[] buffer = new char[65536];
         Reader r = new InputStreamReader(is,charSet);
         Writer w = new StringWriter();



Mime
View raw message