You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2016/06/23 11:06:04 UTC

svn commit: r1749863 - in /manifoldcf/trunk: CHANGES.txt connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java

Author: kwright
Date: Thu Jun 23 11:06:04 2016
New Revision: 1749863

URL: http://svn.apache.org/viewvc?rev=1749863&view=rev
Log:
Fix for CONNECTORS-1325.

Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1749863&r1=1749862&r2=1749863&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Thu Jun 23 11:06:04 2016
@@ -3,6 +3,11 @@ $Id$
 
 ======================= 2.5-dev =====================
 
+CONNECTORS-1325: Deal with SharePoint bad XML when document has 
+optional plane utf-16 characters.  Documents with these are skipped
+since Java can't represent them either.
+(Karl Wright)
+
 CONNECTORS-1324: Fix (again) the SharePoint connector's "use all metadata"
 option.
 (Konstantin Avdeev)

Modified: manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java?rev=1749863&r1=1749862&r2=1749863&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java (original)
+++ manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java Thu Jun 23 11:06:04 2016
@@ -132,7 +132,15 @@ public class SPSProxyHelper {
       if (Logging.connectors.isDebugEnabled())
         Logging.connectors.debug("SharePoint: getACLs xml response: "+xmlResponse);
       
-      XMLDoc doc = new XMLDoc( xmlResponse );
+      final XMLDoc doc;
+      try
+      {
+        doc = new XMLDoc( xmlResponse );
+      }
+      catch (ManifoldCFException e) {
+        return null;
+      }
+      
       ArrayList nodeList = new ArrayList();
 
       doc.processPath(nodeList, "*", null);
@@ -352,7 +360,15 @@ public class SPSProxyHelper {
         Logging.connectors.debug("SharePoint: getDocumentACLs xml response: " + xmlResponse);
       }
 
-      XMLDoc doc = new XMLDoc( xmlResponse );
+      final XMLDoc doc;
+      try
+      {
+        doc = new XMLDoc( xmlResponse );
+      }
+      catch (ManifoldCFException e) {
+        return null;
+      }
+      
       ArrayList nodeList = new ArrayList();
 
       doc.processPath(nodeList, "*", null);
@@ -571,7 +587,14 @@ public class SPSProxyHelper {
         if (Logging.connectors.isDebugEnabled())
           Logging.connectors.debug("SharePoint: getChildren xml response: "+xmlResponse);
 
-        XMLDoc doc = new XMLDoc( xmlResponse );
+        final XMLDoc doc;
+        try
+        {
+          doc = new XMLDoc( xmlResponse );
+        }
+        catch (ManifoldCFException e) {
+          return false;
+        }
 
         doc.processPath(nodeList, "*", null);
         if (nodeList.size() != 1)
@@ -812,7 +835,16 @@ public class SPSProxyHelper {
       final String xmlResponse = lists[0].toString();
       if (Logging.connectors.isDebugEnabled())
         Logging.connectors.debug("SharePoint: getDocLibID xml response: "+xmlResponse);
-      XMLDoc doc = new XMLDoc( xmlResponse );
+      
+      final XMLDoc doc;
+      try
+      {
+        doc = new XMLDoc( xmlResponse );
+      }
+      catch (ManifoldCFException e) {
+        return null;
+      }
+
       ArrayList nodeList = new ArrayList();
 
       doc.processPath(nodeList, "*", null);
@@ -1015,7 +1047,16 @@ public class SPSProxyHelper {
       final String xmlResponse = lists[0].toString();
       if (Logging.connectors.isDebugEnabled())
         Logging.connectors.debug("SharePoint: getListID xml response: "+xmlResponse);
-      XMLDoc doc = new XMLDoc( xmlResponse );
+      
+      final XMLDoc doc;
+      try
+      {
+        doc = new XMLDoc( xmlResponse );
+      }
+      catch (ManifoldCFException e) {
+        return null;
+      }
+
       ArrayList nodeList = new ArrayList();
 
       doc.processPath(nodeList, "*", null);
@@ -1215,7 +1256,15 @@ public class SPSProxyHelper {
       if (Logging.connectors.isDebugEnabled())
         Logging.connectors.debug("SharePoint: getVersions response: "+xmlResponse);
       
-      XMLDoc doc = new XMLDoc( xmlResponse );
+      final XMLDoc doc;
+      try
+      {
+        doc = new XMLDoc( xmlResponse );
+      }
+      catch (ManifoldCFException e) {
+        return null;
+      }
+
       ArrayList nodeList = new ArrayList();
 
       doc.processPath(nodeList, "*", null);
@@ -1641,7 +1690,15 @@ public class SPSProxyHelper {
       if (Logging.connectors.isDebugEnabled())
         Logging.connectors.debug("SharePoint: getAttachmentNames response: "+xmlResponse);
 
-      XMLDoc doc = new XMLDoc( xmlResponse );
+      final XMLDoc doc;
+      try
+      {
+        doc = new XMLDoc( xmlResponse );
+      }
+      catch (ManifoldCFException e) {
+        return null;
+      }
+
       ArrayList nodeList = new ArrayList();
 
       doc.processPath(nodeList, "*", null);
@@ -1766,8 +1823,16 @@ public class SPSProxyHelper {
       final String xmlResponse = List[0].toString();
       if (Logging.connectors.isDebugEnabled())
         Logging.connectors.debug("SharePoint: getFieldList xml response: "+xmlResponse);
+
+      final XMLDoc doc;
+      try
+      {
+        doc = new XMLDoc( xmlResponse );
+      }
+      catch (ManifoldCFException e) {
+        return null;
+      }
       
-      XMLDoc doc = new XMLDoc( xmlResponse );
       ArrayList nodeList = new ArrayList();
 
       doc.processPath(nodeList, "*", null);
@@ -1967,7 +2032,15 @@ public class SPSProxyHelper {
           Logging.connectors.debug("SharePoint: getFieldValues xml response: '" +xmlResponse+ "'");
         }
 
-        XMLDoc doc = new XMLDoc( xmlResponse );
+        final XMLDoc doc;
+        try
+        {
+          doc = new XMLDoc( xmlResponse );
+        }
+        catch (ManifoldCFException e) {
+          return null;
+        }
+
         ArrayList nodeList = new ArrayList();
 
         doc.processPath(nodeList, "*", null);
@@ -2035,7 +2108,15 @@ public class SPSProxyHelper {
         }
 
         ArrayList nodeList = new ArrayList();
-        XMLDoc doc = new XMLDoc(xmlResponse);
+        
+        final XMLDoc doc;
+        try
+        {
+          doc = new XMLDoc( xmlResponse );
+        }
+        catch (ManifoldCFException e) {
+          return null;
+        }
 
         doc.processPath(nodeList, "*", null);
         if (nodeList.size() != 1)
@@ -2174,7 +2255,16 @@ public class SPSProxyHelper {
       final String xmlResponse = webList[0].toString();
       if (Logging.connectors.isDebugEnabled())
         Logging.connectors.debug("SharePoint: getSites xml response: "+xmlResponse);
-      XMLDoc doc = new XMLDoc( xmlResponse );
+      
+      final XMLDoc doc;
+      try
+      {
+        doc = new XMLDoc( xmlResponse );
+      }
+      catch (ManifoldCFException e) {
+        return null;
+      }
+
       ArrayList nodeList = new ArrayList();
 
       doc.processPath(nodeList, "*", null);
@@ -2315,7 +2405,15 @@ public class SPSProxyHelper {
       if (Logging.connectors.isDebugEnabled())
         Logging.connectors.debug("SharePoint: getDocumentLibraries xml response: "+xmlResponse);
       
-      XMLDoc doc = new XMLDoc( xmlResponse );
+      final XMLDoc doc;
+      try
+      {
+        doc = new XMLDoc( xmlResponse );
+      }
+      catch (ManifoldCFException e) {
+        return null;
+      }
+
       ArrayList nodeList = new ArrayList();
 
       doc.processPath(nodeList, "*", null);
@@ -2472,7 +2570,15 @@ public class SPSProxyHelper {
       if (Logging.connectors.isDebugEnabled())
         Logging.connectors.debug("SharePoint: getLists xml response: "+xmlResponse);
 
-      XMLDoc doc = new XMLDoc( xmlResponse );
+      final XMLDoc doc;
+      try
+      {
+        doc = new XMLDoc( xmlResponse );
+      }
+      catch (ManifoldCFException e) {
+        return null;
+      }
+
       ArrayList nodeList = new ArrayList();
 
       doc.processPath(nodeList, "*", null);