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 2014/10/30 14:01:24 UTC

svn commit: r1635487 - in /manifoldcf/branches/dev_1x: ./ connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java

Author: kwright
Date: Thu Oct 30 13:01:23 2014
New Revision: 1635487

URL: http://svn.apache.org/r1635487
Log:
Pull up CONNECTORS-1077 fix for googledrive connector from trunk

Modified:
    manifoldcf/branches/dev_1x/   (props changed)
    manifoldcf/branches/dev_1x/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java

Propchange: manifoldcf/branches/dev_1x/
------------------------------------------------------------------------------
  Merged /manifoldcf/trunk:r1635484

Modified: manifoldcf/branches/dev_1x/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java?rev=1635487&r1=1635486&r2=1635487&view=diff
==============================================================================
--- manifoldcf/branches/dev_1x/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java (original)
+++ manifoldcf/branches/dev_1x/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java Thu Oct 30 13:01:23 2014
@@ -1040,7 +1040,7 @@ public class GoogleDriveRepositoryConnec
 
       if (versionString.length() == 0 || activities.checkDocumentNeedsReindexing(documentIdentifier,versionString)) {
         long startTime = System.currentTimeMillis();
-        String errorCode = "FAILED";
+        String errorCode = null;
         String errorDesc = StringUtils.EMPTY;
         Long fileSize = null;
         boolean doLog = false;
@@ -1137,24 +1137,32 @@ public class GoogleDriveRepositoryConnec
 
               if (!activities.checkLengthIndexable(fileLength))
               {
+                errorCode = activities.EXCLUDED_LENGTH;
+                errorDesc = "Excluding document because of file length ('"+fileLength+"')";
                 activities.noDocument(nodeId,version);
                 continue;
               }
               
               if (!activities.checkURLIndexable(documentURI))
               {
+                errorCode = activities.EXCLUDED_URL;
+                errorDesc = "Excluding document because of URL ('"+documentURI+"')";
                 activities.noDocument(nodeId,version);
                 continue;
               }
               
               if (!activities.checkMimeTypeIndexable(mimeType))
               {
+                errorCode = activities.EXCLUDED_MIMETYPE;
+                errorDesc = "Excluding document because of mime type ("+mimeType+")";
                 activities.noDocument(nodeId,version);
                 continue;
               }
               
               if (!activities.checkDateIndexable(modifiedDate))
               {
+                errorCode = activities.EXCLUDED_DATE;
+                errorDesc = "Excluding document because of date ("+modifiedDate+")";
                 activities.noDocument(nodeId,version);
                 continue;
               }
@@ -1216,8 +1224,10 @@ public class GoogleDriveRepositoryConnec
                 }
 
                 // No errors.  Record the fact that we made it.
-                errorCode = "OK";
                 fileSize = new Long(fileLength);
+                if (doLog){
+                    activities.recordActivity(new Long(startTime), ACTIVITY_READ, fileSize, nodeId, "OK", null, null);
+                }
               } catch (InterruptedException e) {
                 t.interrupt();
                 throw new ManifoldCFException("Interrupted: " + e.getMessage(), e,
@@ -1230,18 +1240,18 @@ public class GoogleDriveRepositoryConnec
                 throw new ManifoldCFException("Interrupted: " + e.getMessage(), e,
                   ManifoldCFException.INTERRUPTED);
               } catch (IOException e) {
-                errorCode = "IO ERROR";
+                errorCode = "IOEXCEPTION";
                 errorDesc = e.getMessage();
                 Logging.connectors.warn("GOOGLEDRIVE: Error reading document: " + e.getMessage(), e);
                 handleIOException(e);
               }
             } else {
-              errorCode = "NO LENGTH";
+              errorCode = "NOLENGTH";
               errorDesc = "Document "+nodeId+" had no length; skipping";
             }
           }
         } finally {
-          if (doLog)
+          if (doLog && errorCode != null)
             activities.recordActivity(new Long(startTime), ACTIVITY_READ,
               fileSize, nodeId, errorCode, errorDesc, null);
         }