jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r903655 - /jackrabbit/sandbox/jackrabbit-spi2cmis/src/main/java/org/apache/jackrabbit/spi2cmis/Spi2cmisRepositoryServiceFactory.java
Date Wed, 27 Jan 2010 14:16:49 GMT
Author: mduerig
Date: Wed Jan 27 14:16:49 2010
New Revision: 903655

URL: http://svn.apache.org/viewvc?rev=903655&view=rev
Log:
Improved error handling

Modified:
    jackrabbit/sandbox/jackrabbit-spi2cmis/src/main/java/org/apache/jackrabbit/spi2cmis/Spi2cmisRepositoryServiceFactory.java

Modified: jackrabbit/sandbox/jackrabbit-spi2cmis/src/main/java/org/apache/jackrabbit/spi2cmis/Spi2cmisRepositoryServiceFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-spi2cmis/src/main/java/org/apache/jackrabbit/spi2cmis/Spi2cmisRepositoryServiceFactory.java?rev=903655&r1=903654&r2=903655&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-spi2cmis/src/main/java/org/apache/jackrabbit/spi2cmis/Spi2cmisRepositoryServiceFactory.java
(original)
+++ jackrabbit/sandbox/jackrabbit-spi2cmis/src/main/java/org/apache/jackrabbit/spi2cmis/Spi2cmisRepositoryServiceFactory.java
Wed Jan 27 14:16:49 2010
@@ -53,8 +53,9 @@
 
     public RepositoryService createRepositoryService(Map<?, ?> parameters) throws RepositoryException
{
         if (parameters == null) {
-            log.warn("Missing arguments. Cannot acquire CMIS repository");
-            return null;
+            String msg = "Missing arguments. Cannot acquire CMIS repository";
+            log.warn(msg);
+            throw new RepositoryException(msg);
         }
 
         Repository cmisRepo;
@@ -66,9 +67,10 @@
                     cmisRepo = (Repository) v;
                 }
                 else {
-                    log.error("Invalid value for {}", PARAM_CMIS_REPOSITORY);
+                    String msg = "Invalid value for " + PARAM_CMIS_REPOSITORY;
+                    log.error(msg);
                     log.error("{} is not an instance of {}", v, Repository.class);
-                    return null;
+                    throw new RepositoryException(msg);
                 }
             }
 
@@ -103,17 +105,22 @@
 
             // todo implement: Support WS bindings
             else {
-                return null;
+                throw new RepositoryException("Not implemented: WS bindings");
             }
         }
+        catch (RepositoryException e) {
+            throw e;
+        }
         catch (Exception e) {
-            log.error("Error acquiring CMIS repositor", e);
-            return null;
+            String msg = "Error acquiring CMIS repositor";
+            log.error(msg, e);
+            throw new RepositoryException(msg, e);
         }
 
         if (cmisRepo == null) {
-            log.error("Error acquiring CMIS repositor");
-            return null;
+            String msg = "Error acquiring CMIS repositor";
+            log.error(msg);
+            throw new RepositoryException(msg);
         }
         else {
             log.info("Acquired CMIS repository \"{}\"", cmisRepo.getName());



Mime
View raw message