Author: kwright
Date: Wed Apr  9 02:54:31 2014
New Revision: 1585882

URL: http://svn.apache.org/r1585882
Log:
Update exception handling

Modified:
    
manifoldcf/branches/CONNECTORS-916/connectors/amazoncloudsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/amazoncloudsearch/AmazonCloudSearchConnector.java

Modified: 
manifoldcf/branches/CONNECTORS-916/connectors/amazoncloudsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/amazoncloudsearch/AmazonCloudSearchConnector.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-916/connectors/amazoncloudsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/amazoncloudsearch/AmazonCloudSearchConnector.java?rev=1585882&r1=1585881&r2=1585882&view=diff
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-916/connectors/amazoncloudsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/amazoncloudsearch/AmazonCloudSearchConnector.java
 (original)
+++ 
manifoldcf/branches/CONNECTORS-916/connectors/amazoncloudsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/amazoncloudsearch/AmazonCloudSearchConnector.java
 Wed Apr  9 02:54:31 2014
@@ -297,20 +297,26 @@ public class AmazonCloudSearchConnector 
       //post data..
       String responsbody = postData(jsondata);
             
-      activities.recordActivity(null,INGEST_ACTIVITY,new 
Long(document.getBinaryLength()),documentURI,"OK",null);
-      return DOCUMENTSTATUS_ACCEPTED;
-      
-    } catch (IOException e) {
-      e.printStackTrace();
-    } catch (SAXException e) {
-      e.printStackTrace();
-    } catch (TikaException e) {
-      e.printStackTrace();
-    }
-    return DOCUMENTSTATUS_REJECTED;
-  }
-
-  /** Remove a document using the connector.
+      activities.recordActivity(null,INGEST_ACTIVITY,new 
Long(document.getBinaryLength()),documentURI,"OK",null);
+      return DOCUMENTSTATUS_ACCEPTED;
+      
+    } 
+    catch (SAXException e) {
+      // if document data could not be converted to JSON by jackson.
+      throw new ManifoldCFException(e);
+    } catch (JsonProcessingException e) {
+      // if document data could not be converted to JSON by jackson.
+      throw new ManifoldCFException(e);
+    } catch (TikaException e) {
+      // if document could not be parsed by tika.
+      return DOCUMENTSTATUS_REJECTED;
+    } catch (IOException e) {
+      // if document data could not be read when the document parsing by tika.
+      throw new ManifoldCFException(e);
+    }
+  }
+
+  /** Remove a document using the connector.
   * Note that the last outputDescription is included, since it may be 
necessary for the connector to use such information to know how to properly 
remove the document.
   *@param documentURI is the URI of the document.  The URI is presumed to be 
the unique identifier which the output data store will use to process
   * and serve the document.  This URI is constructed by the repository 
connector which fetches the document, and is thus universal across all output 
connectors.


Reply via email to