manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1611225 - in /manifoldcf/trunk: ./ connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/ connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/
Date Thu, 17 Jul 2014 00:25:50 GMT
Author: kwright
Date: Thu Jul 17 00:25:49 2014
New Revision: 1611225

URL: http://svn.apache.org/r1611225
Log:
Fix for CONNECTORS-996.

Added:
    manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/APISanityDerbyIT.java
      - copied, changed from r1610947, manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/APISanityIT.java
Removed:
    manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/APISanityIT.java
Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
    manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/BaseITDerby.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1611225&r1=1611224&r2=1611225&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Thu Jul 17 00:25:49 2014
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 1.7-dev =====================
 
+CONNECTORS-996: Catch CMIS object not found exception, and
+also enable CMIS derby IT test.
+(Prasad Perera, Karl Wright)
+
 CONNECTORS-995: Connectors dealing with non-indexable documents
 such as directories should call noDocument() on those documents if they
 want incremental behavior.

Modified: manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java?rev=1611225&r1=1611224&r2=1611225&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
(original)
+++ manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
Thu Jul 17 00:25:49 2014
@@ -50,6 +50,8 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
 import org.apache.chemistry.opencmis.commons.impl.Constants;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
+
 import org.apache.commons.io.input.NullInputStream;
 import org.apache.commons.lang.StringUtils;
 import org.apache.manifoldcf.agents.interfaces.RepositoryDocument;
@@ -1055,9 +1057,8 @@ public class CmisRepositoryConnector ext
 
     getSession();
     Logging.connectors.debug("CMIS: Inside processDocuments");
-    int i = 0;
-
-    while (i < documentIdentifiers.length) {
+        
+    for (int i = 0; i < documentIdentifiers.length; i++) {
       long startTime = System.currentTimeMillis();
       String nodeId = documentIdentifiers[i];
 
@@ -1065,7 +1066,14 @@ public class CmisRepositoryConnector ext
         Logging.connectors.debug("CMIS: Processing document identifier '"
             + nodeId + "'");
 
-      CmisObject cmisObject = session.getObject(nodeId);
+      CmisObject cmisObject;
+      try {
+        cmisObject = session.getObject(nodeId);
+      } catch (CmisObjectNotFoundException e) {
+        // Delete it
+        activities.deleteDocument(nodeId);
+        continue;
+      }
       
       String errorCode = "OK";
       String errorDesc = StringUtils.EMPTY;
@@ -1240,7 +1248,6 @@ public class CmisRepositoryConnector ext
           }
         }
       }
-      i++;
     }
   }
   
@@ -1276,9 +1283,15 @@ public class CmisRepositoryConnector ext
     getSession();
     
     String[] rval = new String[documentIdentifiers.length];
-    int i = 0;
-    while (i < rval.length){
-      CmisObject cmisObject = session.getObject(documentIdentifiers[i]);
+    for (int i = 0; i < rval.length; i++) {
+      CmisObject cmisObject;
+      try {
+        cmisObject = session.getObject(documentIdentifiers[i]);
+      } catch (CmisObjectNotFoundException e) {
+        rval[i] = null;
+        continue;
+      }
+
       if (cmisObject.getBaseType().getId().equals(CMIS_DOCUMENT_BASE_TYPE)) {
         Document document = (Document) cmisObject;
         
@@ -1294,7 +1307,6 @@ public class CmisRepositoryConnector ext
         //a CMIS folder will always be processed
         rval[i] = StringUtils.EMPTY;
       }
-      i++;
     }
     return rval;
   }

Copied: manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/APISanityDerbyIT.java
(from r1610947, manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/APISanityIT.java)
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/APISanityDerbyIT.java?p2=manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/APISanityDerbyIT.java&p1=manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/APISanityIT.java&r1=1610947&r2=1611225&rev=1611225&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/APISanityIT.java
(original)
+++ manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/APISanityDerbyIT.java
Thu Jul 17 00:25:49 2014
@@ -51,7 +51,7 @@ import org.junit.Test;
 /**
  * @author Piergiorgio Lucidi
  */
-public class APISanityIT extends BaseITDerby
+public class APISanityDerbyIT extends BaseITDerby
 {
   private static final String REPLACER = "?";
   private static final String CMIS_TEST_QUERY_CHANGE_DOC = "SELECT * FROM cmis:document WHERE
cmis:name='"+REPLACER+"'";

Modified: manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/BaseITDerby.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/BaseITDerby.java?rev=1611225&r1=1611224&r2=1611225&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/BaseITDerby.java
(original)
+++ manifoldcf/trunk/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/cmis/tests/BaseITDerby.java
Thu Jul 17 00:25:49 2014
@@ -58,7 +58,7 @@ public class BaseITDerby extends org.apa
   public void setUpCMIS()
     throws Exception
   {
-    String openCmisServerWarPath = "../../lib/chemistry-opencmis-server-inmemory.war";
+    String openCmisServerWarPath = "../../../lib/chemistry-opencmis-server-inmemory.war";
 
     if (System.getProperty("openCmisServerWarPath") != null)
       openCmisServerWarPath = System.getProperty("openCmisServerWarPath");



Mime
View raw message