manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From piergior...@apache.org
Subject svn commit: r1493092 - in /manifoldcf/trunk: ./ connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/
Date Fri, 14 Jun 2013 14:37:14 GMT
Author: piergiorgio
Date: Fri Jun 14 14:37:13 2013
New Revision: 1493092

URL: http://svn.apache.org/r1493092
Log:
now Alfresco Connector manage all the exceptions using handlers (CONNECTORS-718)

Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
    manifoldcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/ContentModelUtils.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1493092&r1=1493091&r2=1493092&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Fri Jun 14 14:37:13 2013
@@ -3,6 +3,9 @@ $Id$
 
 ======================= 1.3-dev =====================
 
+CONNECTORS-718: Alfresco Connector must throw exceptions with handler methods
+(Piergiorgio Lucidi, Karl Wright)
+
 CONNECTORS-713: Alfresco connector needs to deal with IOExceptions better
 (Piergiorgio Lucidi, Karl Wright)
 

Modified: manifoldcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java?rev=1493092&r1=1493091&r2=1493092&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
(original)
+++ manifoldcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
Fri Jun 14 14:37:13 2013
@@ -904,6 +904,7 @@ public class AlfrescoRepositoryConnector
           Logging.connectors.warn(
               "Alfresco: Error during the reading process of dates: "
                   + e.getMessage(), e);
+          handleParseException(e);
         } catch (IOException e) {
           Logging.connectors.warn(
               "Alfresco: IOException: "
@@ -938,7 +939,7 @@ public class AlfrescoRepositoryConnector
       i++;
     }
   }
-  
+
   /** The short version of getDocumentVersions.
    * Get document versions given an array of document identifiers.
    * This method is called for EVERY document that is considered. It is
@@ -1009,6 +1010,12 @@ public class AlfrescoRepositoryConnector
       long currentTime = System.currentTimeMillis();
       throw new ServiceInterruption("IO exception: "+e.getMessage(), e, currentTime + 300000L,
         currentTime + 3 * 60 * 60000L,-1,false);
-    }
+  }
+  
+  private void handleParseException(ParseException e) 
+      throws ManifoldCFException {
+    throw new ManifoldCFException(
+        "Alfresco: Error during parsing date values. This should never happen: "+e.getMessage(),e);
+  }
 
 }

Modified: manifoldcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/ContentModelUtils.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/ContentModelUtils.java?rev=1493092&r1=1493091&r2=1493092&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/ContentModelUtils.java
(original)
+++ manifoldcf/trunk/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/ContentModelUtils.java
Fri Jun 14 14:37:13 2013
@@ -18,7 +18,6 @@
  */
 package org.apache.manifoldcf.crawler.connectors.alfresco;
 
-import java.io.IOException;
 import java.rmi.RemoteException;
 
 import org.alfresco.webservice.repository.QueryResult;
@@ -30,6 +29,7 @@ import org.alfresco.webservice.types.Res
 import org.alfresco.webservice.util.AuthenticationDetails;
 import org.alfresco.webservice.util.AuthenticationUtils;
 import org.alfresco.webservice.util.WebServiceFactory;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
 import org.apache.manifoldcf.crawler.system.Logging;
 
 public class ContentModelUtils {
@@ -55,7 +55,7 @@ public class ContentModelUtils {
    * @param node
    * @return TRUE if the reference contains a node that is an Alfresco space, otherwise FALSE
    */
-  public static boolean isFolder(String endpoint, String username, String password, AuthenticationDetails
session, Reference node) throws IOException {
+  public static boolean isFolder(String endpoint, String username, String password, AuthenticationDetails
session, Reference node) throws ManifoldCFException {
     QueryResult queryResult = null;
     try {
       WebServiceFactory.setEndpointAddress(endpoint);
@@ -75,20 +75,32 @@ public class ContentModelUtils {
         }
       }
       AuthenticationUtils.endSession();
-      return false;
     } catch (RepositoryFault e) {
       Logging.connectors.warn(
           "Alfresco: Repository Error during the queryChildren: "
               + e.getMessage(), e);
-      throw new IOException("Alfresco: Repository Error during the queryChildren: "
-          + e.getMessage(), e);
+      ContentModelUtils.handleRepositoryFaultException(e);
     } catch (RemoteException e) {
       Logging.connectors.warn(
           "Alfresco: Remote Error during the queryChildren: "
               + e.getMessage(), e);
-      throw e;
+      ContentModelUtils.handleRemoteException(e);
     } finally {
       session = null;
     }
+    return false;
+  }
+  
+  public static void handleRepositoryFaultException(RepositoryFault e) 
+      throws ManifoldCFException {
+    throw new ManifoldCFException(
+        "Alfresco: Error during getting children: "+e.getMessage(),e);
   }
+  
+  public static void handleRemoteException(RemoteException e) 
+      throws ManifoldCFException {
+    throw new ManifoldCFException(
+        "Alfresco: Error during getting children: "+e.getMessage(),e);
+  }
+  
 }
\ No newline at end of file



Mime
View raw message