Repository: oodt
Updated Branches:
  refs/heads/master b8d99d611 -> 0c67a3305


OODT-909 create improved exceptions


Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/c364b7b1
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/c364b7b1
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/c364b7b1

Branch: refs/heads/master
Commit: c364b7b1e50541f73491d75dd580adfadefd4a8d
Parents: b8d99d6
Author: Tom Barber <[email protected]>
Authored: Tue Oct 27 20:17:30 2015 +0000
Committer: Tom Barber <[email protected]>
Committed: Tue Oct 27 20:17:30 2015 +0000

----------------------------------------------------------------------
 .../catalog/solr/DefaultProductSerializer.java  |  7 +++++--
 .../cas/filemgr/catalog/solr/SolrClient.java    | 10 +++++----
 .../action/DeleteProductByNameCliAction.java    |  7 ++++++-
 .../exceptions/FileManagerException.java        | 11 ++++++++++
 .../cas/filemgr/ingest/CmdLineIngester.java     |  5 ++++-
 .../oodt/cas/filemgr/structs/Product.java       |  6 ++++--
 .../conv/AsciiSortableVersionConverter.java     |  2 +-
 .../cas/filemgr/system/XmlRpcFileManager.java   | 14 ++++++-------
 .../filemgr/system/XmlRpcFileManagerClient.java |  7 ++++---
 .../filemgr/system/auth/SecureWebServer.java    |  9 ++++----
 .../cas/filemgr/tools/DumpDbElementsToXml.java  | 11 ++++++----
 .../oodt/cas/filemgr/tools/ExpImpCatalog.java   | 22 ++++++++++++--------
 .../tools/MetadataBasedProductMover.java        | 15 ++++++++-----
 .../oodt/cas/filemgr/tools/MetadataDumper.java  |  2 +-
 .../filemgr/tools/OptimizeLuceneCatalog.java    |  2 +-
 .../oodt/cas/filemgr/tools/ProductDumper.java   |  2 +-
 .../cas/filemgr/tools/ProductTypeDocTool.java   | 10 ++++++---
 .../oodt/cas/filemgr/tools/QueryTool.java       |  8 +++----
 .../oodt/cas/filemgr/tools/SolrIndexer.java     |  2 +-
 19 files changed, 96 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
index 74e070c..a6b4eef 100644
--- 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
+++ 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
@@ -26,7 +26,9 @@ import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
 
+import java.io.IOException;
 import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.Date;
@@ -36,6 +38,7 @@ import java.util.Map;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
 
 /**
  * Default implementation of {@link ProductSerializer} 
@@ -472,10 +475,10 @@ public class DefaultProductSerializer implements 
ProductSerializer {
                
        }
        
-       private Document parseXml(String xml) throws Exception {
+       private Document parseXml(String xml) throws IOException, SAXException, 
ParserConfigurationException {
                
                DocumentBuilderFactory factory = 
DocumentBuilderFactory.newInstance();
-               DocumentBuilder parser = factory.newDocumentBuilder();
+               DocumentBuilder parser = factoriy.newDocumentBuilder();
          return parser.parse( new InputSource(new StringReader(xml)) );
     
        }

http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java
 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java
index dbae244..bd5551f 100644
--- 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java
+++ 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java
@@ -27,6 +27,7 @@ import org.apache.oodt.cas.filemgr.structs.ProductType;
 import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
 
 import java.io.BufferedReader;
+import java.io.IOException;
 import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -189,7 +190,7 @@ public class SolrClient {
         * Method to commit the current changes to the Solr index.
         * @throws Exception
         */
-       public void commit() throws Exception {
+       public void commit() throws IOException, CatalogException {
                
                String message = "<commit waitSearcher=\"true\"/>";
                String url =  this.buildUpdateUrl();
@@ -227,7 +228,8 @@ public class SolrClient {
         * @param parameters
         * @return
         */
-       private String doGet(String url, Map<String, String[]> parameters, 
String mimeType)  throws Exception {
+       private String doGet(String url, Map<String, String[]> parameters, 
String mimeType)
+               throws IOException, CatalogException {
                                    
                // build HTTP/GET request
     GetMethod method = new GetMethod(url);
@@ -253,7 +255,7 @@ public class SolrClient {
         * @param document
         * @return
         */
-       private String doPost(String url, String document, String mimeType) 
throws Exception {
+       private String doPost(String url, String document, String mimeType) 
throws IOException, CatalogException {
     
                // build HTTP/POST request
     PostMethod method = new PostMethod(url);
@@ -271,7 +273,7 @@ public class SolrClient {
         * @return
         * @throws Exception
         */
-       private String doHttp(HttpMethod method) throws Exception {
+       private String doHttp(HttpMethod method) throws IOException, 
CatalogException {
                
                StringBuilder response = new StringBuilder();
                BufferedReader br = null;

http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByNameCliAction.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByNameCliAction.java
 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByNameCliAction.java
index 254d02f..c911430 100644
--- 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByNameCliAction.java
+++ 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/DeleteProductByNameCliAction.java
@@ -22,6 +22,10 @@ import org.apache.commons.lang.Validate;
 //OODT imports
 import org.apache.oodt.cas.cli.exception.CmdLineActionException;
 import org.apache.oodt.cas.filemgr.structs.Product;
+import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+
+import java.net.MalformedURLException;
 
 /**
  * A {@link CmdLineAction} which deletes a {@link Product} by name.
@@ -34,7 +38,8 @@ public class DeleteProductByNameCliAction extends
    private String productName;
 
    @Override
-   protected Product getProductToDelete() throws Exception {
+   protected Product getProductToDelete()
+       throws CmdLineActionException, MalformedURLException, 
ConnectionException, CatalogException {
       Validate.notNull(productName, "Must specify productName");
 
       Product p = getClient().getProductByName(productName);

http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/exceptions/FileManagerException.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/exceptions/FileManagerException.java
 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/exceptions/FileManagerException.java
new file mode 100644
index 0000000..1561fcf
--- /dev/null
+++ 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/exceptions/FileManagerException.java
@@ -0,0 +1,11 @@
+package org.apache.oodt.cas.filemgr.exceptions;
+
+/**
+ * Created by bugg on 27/10/15.
+ */
+public class FileManagerException extends Exception {
+
+  public FileManagerException(String message){
+    super(message);
+  }
+}

http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/CmdLineIngester.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/CmdLineIngester.java 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/CmdLineIngester.java
index 4aa9912..59d0736 100644
--- 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/CmdLineIngester.java
+++ 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/CmdLineIngester.java
@@ -19,6 +19,7 @@
 package org.apache.oodt.cas.filemgr.ingest;
 
 //OODT imports
+import org.apache.oodt.cas.filemgr.structs.exceptions.IngestException;
 import org.apache.oodt.cas.metadata.MetExtractor;
 import org.apache.oodt.cas.metadata.SerializableMetadata;
 import org.apache.oodt.cas.metadata.util.GenericMetadataObjectFactory;
@@ -28,8 +29,10 @@ import 
org.apache.oodt.cas.metadata.util.GenericMetadataObjectFactory;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.List;
 import java.util.Vector;
@@ -60,7 +63,7 @@ public class CmdLineIngester extends StdIngester {
      * @throws org.apache.oodt.cas.filemgr.structs.exceptions.IngestException
      * @throws java.net.MalformedURLException
      */
-    public static void main(String[] args) throws Exception {
+    public static void main(String[] args) throws IOException, IngestException 
{
         String usage = CmdLineIngester.class.getName()
                 + " --url <filemgr url> [options]\n"
                 + "[--extractor <met extractor class name> <met conf file 
path>|"

http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java
index cfc7d41..242db6d 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java
@@ -18,6 +18,8 @@
 package org.apache.oodt.cas.filemgr.structs;
 
 //JDK imports
+
+import org.apache.oodt.cas.filemgr.exceptions.FileManagerException;
 import org.apache.oodt.commons.xml.XMLUtils;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -274,7 +276,7 @@ public class Product {
         return defaultProduct;
     }
 
-    public Document toXML() throws Exception {
+    public Document toXML() throws UnsupportedEncodingException, 
FileManagerException {
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         factory.setNamespaceAware(true);
         Document doc;
@@ -315,7 +317,7 @@ public class Product {
         } catch (ParserConfigurationException pce) {
             LOG.log(Level.WARNING, "Error generating product xml file!: "
                     + pce.getMessage());
-            throw new Exception("Error generating product xml file!: "
+            throw new FileManagerException("Error generating product xml 
file!: "
                     + pce.getMessage());
         }
 

http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/conv/AsciiSortableVersionConverter.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/conv/AsciiSortableVersionConverter.java
 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/conv/AsciiSortableVersionConverter.java
index e56dfee..23be461 100644
--- 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/conv/AsciiSortableVersionConverter.java
+++ 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/conv/AsciiSortableVersionConverter.java
@@ -28,7 +28,7 @@ package org.apache.oodt.cas.filemgr.structs.query.conv;
  */
 public class AsciiSortableVersionConverter implements VersionConverter {
 
-    public double convertToPriority(String version) throws Exception {
+    public double convertToPriority(String version) {
         double priority = 0;
         char[] versionCharArray = version.toCharArray();
         for (int i = 0, j = versionCharArray.length - 1; i < 
versionCharArray.length; i++, j--)

http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java
 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java
index baa30e1..a2a0d9b 100644
--- 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java
+++ 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java
@@ -54,6 +54,7 @@ import org.apache.oodt.cas.filemgr.versioning.VersioningUtils;
 import org.apache.oodt.cas.metadata.Metadata;
 import org.apache.oodt.cas.metadata.exceptions.MetExtractionException;
 import org.apache.oodt.commons.date.DateUtils;
+import org.apache.oodt.commons.exceptions.CommonsException;
 import org.apache.xmlrpc.WebServer;
 
 import java.io.File;
@@ -64,6 +65,7 @@ import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.text.ParseException;
 import java.util.Arrays;
 import java.util.Hashtable;
 import java.util.LinkedList;
@@ -119,7 +121,7 @@ public class XmlRpcFileManager {
      *            The web server port to run the XML Rpc server on, defaults to
      *            1999.
      */
-    public XmlRpcFileManager(int port) throws Exception {
+    public XmlRpcFileManager(int port) throws IOException {
         webServerPort = port;
 
         // start up the web server
@@ -993,7 +995,7 @@ public class XmlRpcFileManager {
         return XmlRpcStructFactory.getXmlRpcQuery(this.getCatalogQuery(query, 
productType));
     }
 
-    public static void main(String[] args) throws Exception {
+    public static void main(String[] args) throws IOException {
         int portNum = -1;
         String usage = "FileManager --portNum <port number for xml rpc 
service>\n";
 
@@ -1129,15 +1131,11 @@ public class XmlRpcFileManager {
         return true;
     }
 
-    private void setProductType(List<Product> products) throws Exception {
+    private void setProductType(List<Product> products) throws 
RepositoryManagerException {
         if (products != null && products.size() > 0) {
           for (Product p : products) {
-            try {
               p.setProductType(repositoryManager.getProductTypeById(p
                   .getProductType().getProductTypeId()));
-            } catch (RepositoryManagerException e) {
-              throw new Exception(e.getMessage());
-            }
           }
         }
     }
@@ -1249,7 +1247,7 @@ public class XmlRpcFileManager {
     @SuppressWarnings("unchecked")
     private List<QueryResult> applyFilterToResults(
             List<QueryResult> queryResults, QueryFilter queryFilter)
-            throws Exception {
+        throws Exception {
         List<TimeEvent> events = new LinkedList<TimeEvent>();
         for (QueryResult queryResult : queryResults) {
             Metadata m = new Metadata();

http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
index b8bb51f..eda060e 100644
--- 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
+++ 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
@@ -23,6 +23,7 @@ import org.apache.commons.httpclient.HttpMethodRetryHandler;
 import org.apache.commons.httpclient.params.HttpMethodParams;
 import org.apache.oodt.cas.cli.CmdLineUtility;
 import org.apache.oodt.cas.filemgr.datatransfer.DataTransfer;
+import org.apache.oodt.cas.filemgr.exceptions.FileManagerException;
 import org.apache.oodt.cas.filemgr.structs.Element;
 import org.apache.oodt.cas.filemgr.structs.FileTransferStatus;
 import org.apache.oodt.cas.filemgr.structs.Product;
@@ -1179,7 +1180,7 @@ public class XmlRpcFileManagerClient {
     }
 
     public String ingestProduct(Product product, Metadata metadata,
-            boolean clientTransfer) throws Exception {
+            boolean clientTransfer) throws VersioningException, 
XmlRpcException, FileManagerException {
         try {
             // ingest product
             Vector<Object> argList = new Vector<Object>();
@@ -1293,7 +1294,7 @@ public class XmlRpcFileManagerClient {
             LOG.log(Level.SEVERE, "Failed to rollback ingest of product ["
                                   + product + "] : " + e2.getMessage());
           }
-          throw new Exception(e2);
+          throw e2;
         }
         catch (Exception e) {
           LOG.log(Level.SEVERE, "Failed to ingest product [ id: " + 
product.getProductId() +
@@ -1308,7 +1309,7 @@ public class XmlRpcFileManagerClient {
                 LOG.log(Level.SEVERE, "Failed to rollback ingest of product ["
                         + product + "] : " + e.getMessage());
             }
-            throw new Exception("Failed to ingest product [" + product + "] : "
+            throw new FileManagerException("Failed to ingest product [" + 
product + "] : "
                     + e.getMessage());
         }
 

http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/SecureWebServer.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/SecureWebServer.java
 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/SecureWebServer.java
index 46d87d6..445c052 100644
--- 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/SecureWebServer.java
+++ 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/SecureWebServer.java
@@ -18,13 +18,14 @@
 package org.apache.oodt.cas.filemgr.system.auth;
 
 //JDK imports
-import java.util.List;
+import org.apache.xmlrpc.AuthenticatedXmlRpcHandler;
+
+import java.io.IOException;
 import java.util.ArrayList;
+import java.util.List;
 import java.util.Vector;
-import java.io.IOException;
 
 //XML-RPC imports
-import org.apache.xmlrpc.AuthenticatedXmlRpcHandler;
 
 /**
  * An XML-RPC Web Server that requires authentication and authorization.
@@ -60,7 +61,7 @@ public final class SecureWebServer extends 
org.apache.xmlrpc.WebServer
      * @pass The password to use for the user.
      */
     public Object execute(String methodSpecifier, Vector params, String user,
-            String password) throws Exception {
+            String password) {
         for (Object dispatcher : dispatchers) {
             Result rc = ((Dispatcher) 
dispatcher).handleRequest(methodSpecifier,
                 params, user, password);

http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DumpDbElementsToXml.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DumpDbElementsToXml.java
 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DumpDbElementsToXml.java
index 0982219..2165579 100644
--- 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DumpDbElementsToXml.java
+++ 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DumpDbElementsToXml.java
@@ -18,14 +18,17 @@
 package org.apache.oodt.cas.filemgr.tools;
 
 //JDK imports
+import org.apache.oodt.cas.filemgr.structs.exceptions.ValidationLayerException;
+import org.apache.oodt.cas.filemgr.util.XmlStructFactory;
+import org.apache.oodt.cas.filemgr.validation.DataSourceValidationLayerFactory;
+import org.apache.oodt.cas.filemgr.validation.ValidationLayer;
+
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.IOException;
 import java.util.List;
 
 //OODT imports
-import org.apache.oodt.cas.filemgr.util.XmlStructFactory;
-import org.apache.oodt.cas.filemgr.validation.DataSourceValidationLayerFactory;
-import org.apache.oodt.cas.filemgr.validation.ValidationLayer;
 
 /**
  * @author mattmann
@@ -47,7 +50,7 @@ public final class DumpDbElementsToXml {
     /**
      * @param args
      */
-    public static void main(String[] args) throws Exception {
+    public static void main(String[] args) throws IOException, 
ValidationLayerException {
         String propFile = null, outXmlFile = null;
         String usage = "DumpDbElementsToXml --propFile </path/to/propFile> 
--out </path/to/xml/file>\n";
 

http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java
index bbb764e..ef90492 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java
@@ -17,25 +17,26 @@
 
 package org.apache.oodt.cas.filemgr.tools;
 
-// JDK imports
 import org.apache.oodt.cas.filemgr.catalog.Catalog;
+import org.apache.oodt.cas.filemgr.exceptions.FileManagerException;
 import org.apache.oodt.cas.filemgr.structs.Product;
 import org.apache.oodt.cas.filemgr.structs.ProductPage;
 import org.apache.oodt.cas.filemgr.structs.ProductType;
 import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
 import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+import 
org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException;
 import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
 import org.apache.oodt.cas.filemgr.util.GenericFileManagerObjectFactory;
 import org.apache.oodt.cas.metadata.Metadata;
 
 import java.io.File;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.List;
 import java.util.Vector;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-// OODT imports
 
 /**
  * @author mattmann
@@ -137,7 +138,8 @@ public class ExpImpCatalog {
 
     }
 
-    public void doExpImport(List sourceProductTypes) throws Exception {
+    public void doExpImport(List sourceProductTypes)
+        throws FileManagerException, RepositoryManagerException, 
CatalogException {
 
         if (this.sourceClient != null && this.destClient != null) {
             // do validation of source/dest types
@@ -145,7 +147,7 @@ public class ExpImpCatalog {
             List destProductTypes = destClient.getProductTypes();
 
             if (!typesExist(sourceProductTypes, destProductTypes)) {
-                throw new Exception(
+                throw new FileManagerException(
                         "The source product types must be present in the dest 
file manager!");
             } else {
                 LOG
@@ -163,7 +165,7 @@ public class ExpImpCatalog {
         ProductType type = (ProductType) sourceProductType;
         try {
           exportTypeToDest(type);
-        } catch (Exception e) {
+        } catch (CatalogException e) {
           LOG.log(Level.WARNING, "Error exporting product type: ["
                                  + type.getName() + "] from source to dest: 
Message: "
                                  + e.getMessage(), e);
@@ -173,7 +175,7 @@ public class ExpImpCatalog {
 
     }
 
-    public void doExpImport() throws Exception {
+    public void doExpImport() throws RepositoryManagerException, 
FileManagerException, CatalogException {
         if (sourceClient == null)
             throw new RuntimeException(
                     "Cannot request exp/imp of all product types if no filemgr 
url specified!");
@@ -181,7 +183,7 @@ public class ExpImpCatalog {
         doExpImport(sourceProductTypes);
     }
 
-    private void exportTypeToDest(ProductType type) throws Exception {
+    private void exportTypeToDest(ProductType type) throws CatalogException, 
RepositoryManagerException {
         ProductPage page;
 
         if (this.srcCatalog != null) {
@@ -206,7 +208,7 @@ public class ExpImpCatalog {
     }
 
     private void exportProductsToDest(List products, ProductType type)
-            throws Exception {
+        throws CatalogException, RepositoryManagerException {
         if (products != null && products.size() > 0) {
           for (Object product : products) {
             Product p = (Product) product;
@@ -324,7 +326,9 @@ public class ExpImpCatalog {
     /**
      * @param args
      */
-    public static void main(String[] args) throws Exception {
+    public static void main(String[] args)
+        throws RepositoryManagerException, FileManagerException, 
MalformedURLException, InstantiationException,
+        CatalogException {
         String sourceUrl = null, destUrl = null, srcCatPropFile = null, 
destCatPropFile = null;
         boolean unique = false;
         List types = null;

http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataBasedProductMover.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataBasedProductMover.java
 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataBasedProductMover.java
index 694bf3c..8092018 100644
--- 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataBasedProductMover.java
+++ 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataBasedProductMover.java
@@ -17,12 +17,14 @@
 
 package org.apache.oodt.cas.filemgr.tools;
 
-//JDK imports
 import org.apache.oodt.cas.filemgr.structs.Product;
 import org.apache.oodt.cas.filemgr.structs.ProductPage;
 import org.apache.oodt.cas.filemgr.structs.ProductType;
 import org.apache.oodt.cas.filemgr.structs.Reference;
+import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
 import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.DataTransferException;
+import 
org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException;
 import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
 import org.apache.oodt.cas.metadata.Metadata;
 import org.apache.oodt.cas.metadata.util.PathUtils;
@@ -30,11 +32,11 @@ import org.apache.oodt.cas.metadata.util.PathUtils;
 import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-//OODT imports
 
 /**
  * @author mattmann
@@ -83,7 +85,7 @@ public class MetadataBasedProductMover {
         }
     }
 
-    public void moveProducts(ProductType type) throws Exception {
+    public void moveProducts(ProductType type) throws CatalogException, 
URISyntaxException, DataTransferException {
         // paginate through the product list
 
         ProductPage page = fmgrClient.getFirstPage(type);
@@ -132,14 +134,17 @@ public class MetadataBasedProductMover {
        
     }
     
-    public void moveProducts(String typeName) throws Exception {
+    public void moveProducts(String typeName)
+        throws RepositoryManagerException, CatalogException, 
DataTransferException, URISyntaxException {
         moveProducts(fmgrClient.getProductTypeByName(typeName));
     }
 
     /**
      * @param args
      */
-    public static void main(String[] args) throws Exception {
+    public static void main(String[] args)
+        throws URISyntaxException, CatalogException, 
RepositoryManagerException, DataTransferException,
+        InstantiationException {
         String typeName = null, pathSpec = null, fmUrlStr = null;
         String usage = "MetadataBasedProductMover [options]\n"
                 + "--typeName <product type>\n"

http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java
index bc2c26e..b842dd2 100644
--- 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java
+++ 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java
@@ -139,7 +139,7 @@ public final class MetadataDumper {
     /**
      * @param args
      */
-    public static void main(String[] args) throws Exception {
+    public static void main(String[] args) throws InstantiationException {
         String fileManagerUrlStr = null, productId = null, outDirPath = null;
         String usage = "MetadataDumper --url <filemgr url> --productId <id> 
[--out <dir path>]\n";
 

http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/OptimizeLuceneCatalog.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/OptimizeLuceneCatalog.java
 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/OptimizeLuceneCatalog.java
index 06d1d79..9cec69b 100644
--- 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/OptimizeLuceneCatalog.java
+++ 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/OptimizeLuceneCatalog.java
@@ -83,7 +83,7 @@ public class OptimizeLuceneCatalog {
     /**
      * @param args
      */
-    public static void main(String[] args) throws Exception {
+    public static void main(String[] args)  {
         String usage = "OptimizeLuceneCatalog [options]\n"
                 + "--catalogPath <path to lucene catalog>\n"
                 + "[--mergeFactor <merge factor for index>]\n";

http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java
index 289d1b6..da98438 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java
@@ -151,7 +151,7 @@ public final class ProductDumper {
     /**
      * @param args
      */
-    public static void main(String[] args) throws Exception {
+    public static void main(String[] args) throws InstantiationException {
         String fileManagerUrlStr = null, productId = null, outDirPath = null;
         String usage = "ProductDumper --url <filemgr url> --productId <id> 
[--out <dir path>]\n";
 

http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java
 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java
index fac190d..2411f50 100644
--- 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java
+++ 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductTypeDocTool.java
@@ -19,9 +19,13 @@ package org.apache.oodt.cas.filemgr.tools;
 
 //JDK imports
 import java.io.File;
+import java.io.IOException;
+
 import javax.xml.transform.OutputKeys;
 import javax.xml.transform.Result;
 import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
@@ -36,7 +40,7 @@ import org.apache.commons.io.FileUtils;
  * <p>
  * A tool to output HTML documentation for {@link ProductType} policy xml 
files.
  * </p>.
- */
+ */o
 public final class ProductTypeDocTool {
 
     private String xslFilePath;
@@ -52,7 +56,7 @@ public final class ProductTypeDocTool {
     }
 
     public void doProductTypeDoc(String productTypeXmlFilePath,
-            String elementXmlFilePath) throws Exception {
+            String elementXmlFilePath) throws IOException, 
TransformerException {
         // copy element xml to current path
         FileUtils.copyFileToDirectory(new File(elementXmlFilePath), new File(
                 "."));
@@ -91,7 +95,7 @@ public final class ProductTypeDocTool {
         new File(elementLocalFilePath).delete();
     }
 
-    public static void main(String[] args) throws Exception {
+    public static void main(String[] args) throws IOException, 
TransformerException {
         String productTypeXmlFilePath = null, xslFilePath = null, 
outputDirPath = null, elementXmlFilePath = null;
         String usage = "ProductTypeDocTool --productTypeXml <path> "
                 + "--elementXml <path> --xsl <path> --out <dir path>\n";

http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java
index e36c262..c1c1a0b 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java
@@ -17,7 +17,6 @@
 
 package org.apache.oodt.cas.filemgr.tools;
 
-//JDK imports
 import org.apache.lucene.index.Term;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.queryParser.QueryParser;
@@ -47,9 +46,6 @@ import java.util.Vector;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-//OODT imports
-//APACHE imports
-
 /**
  * @author mattmann
  * @author bfoster
@@ -173,7 +169,9 @@ public final class QueryTool {
         return prodTypes;
     }
 
-    public static void main(String[] args) throws Exception {
+    public static void main(String[] args)
+        throws MalformedURLException, InstantiationException, 
CatalogException, QueryFormulationException,
+        ConnectionException {
         String usage = "Usage: QueryTool [options] \n"
             + "options: \n"
             + "--url <fm url> \n"

http://git-wip-us.apache.org/repos/asf/oodt/blob/c364b7b1/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java
index d75d652..89e1226 100755
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java
@@ -620,7 +620,7 @@ public class SolrIndexer {
         * @param args
         *          Command-line arguments.
         */
-       public static void main(String[] args) throws Exception {
+       public static void main(String[] args)  {
                Options options = SolrIndexer.buildCommandLine();
                CommandLineParser parser = new GnuParser();
                CommandLine line = null;

Reply via email to