jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1464606 - in /jackrabbit/trunk: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ jackrabbit-jcr-rmi/src/test/java/org/apache/jackrabbit/rmi/ jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/ jackrabbit-jcr2dav/src/tes...
Date Thu, 04 Apr 2013 15:52:11 GMT
Author: jukka
Date: Thu Apr  4 15:52:10 2013
New Revision: 1464606

URL: http://svn.apache.org/r1464606
Log:
JCR-3559: RepositoryStubExceptions with root causes

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/JackrabbitRepositoryStub.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/test/java/org/apache/jackrabbit/rmi/RepositoryStubImpl.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/JNDIRepositoryStub.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/RepositoryStub.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/RepositoryStubException.java
    jackrabbit/trunk/jackrabbit-jcr2dav/src/test/java/org/apache/jackrabbit/jcr2dav/RepositoryStubImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2dav/RepositoryStubImpl.java
    jackrabbit/trunk/jackrabbit-spi2jcr/src/test/java/org/apache/jackrabbit/spi2jcr/RepositoryStubImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/JackrabbitRepositoryStub.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/JackrabbitRepositoryStub.java?rev=1464606&r1=1464605&r2=1464606&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/JackrabbitRepositoryStub.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/JackrabbitRepositoryStub.java
Thu Apr  4 15:52:10 2013
@@ -154,12 +154,8 @@ public class JackrabbitRepositoryStub ex
             }
 
             return getOrCreateRepository(dir, xml);
-
         } catch (Exception e) {
-            RepositoryStubException exception =
-                    new RepositoryStubException("Failed to start repository");
-            exception.initCause(e);
-            throw exception;
+            throw new RepositoryStubException("Failed to start repository", e);
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/src/test/java/org/apache/jackrabbit/rmi/RepositoryStubImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/test/java/org/apache/jackrabbit/rmi/RepositoryStubImpl.java?rev=1464606&r1=1464605&r2=1464606&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/test/java/org/apache/jackrabbit/rmi/RepositoryStubImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/test/java/org/apache/jackrabbit/rmi/RepositoryStubImpl.java
Thu Apr  4 15:52:10 2013
@@ -77,7 +77,7 @@ public class RepositoryStubImpl extends 
                 repository =
                     laf.getRepository((RemoteRepository) ois.readObject());
             } catch (Exception e) {
-                throw new RepositoryStubException(e.getMessage());
+                throw new RepositoryStubException(e);
             }
         }
         return repository;

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/JNDIRepositoryStub.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/JNDIRepositoryStub.java?rev=1464606&r1=1464605&r2=1464606&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/JNDIRepositoryStub.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/JNDIRepositoryStub.java
Thu Apr  4 15:52:10 2013
@@ -59,9 +59,10 @@ public class JNDIRepositoryStub extends 
 
             } catch (ClassCastException e) {
                 // ClassCastException may be thrown by ProtableRemoteObject.narrow()
-                throw new RepositoryStubException("Object cannot be narrowed to javax.jcr.Repository:
" + e);
+                throw new RepositoryStubException(
+                        "Object cannot be narrowed to javax.jcr.Repository", e);
             } catch (NamingException e) {
-                throw new RepositoryStubException(e.getMessage());
+                throw new RepositoryStubException(e);
             }
         }
         return repository;

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/RepositoryStub.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/RepositoryStub.java?rev=1464606&r1=1464605&r2=1464606&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/RepositoryStub.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/RepositoryStub.java
Thu Apr  4 15:52:10 2013
@@ -21,7 +21,6 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.security.Principal;
 import java.util.Map;
 import java.util.Properties;
@@ -182,8 +181,8 @@ public abstract class RepositoryStub {
                 try {
                     props.load(new FileInputStream(implPropFile));
                 } catch (IOException e) {
-                    throw new RepositoryStubException("Unable to load config file: "
-                            + implProp + " " + e.toString());
+                    throw new RepositoryStubException(
+                            "Unable to load config file: " + implProp, e);
                 }
             } else {
                 throw new RepositoryStubException("File does not exist: " + implProp);
@@ -197,8 +196,8 @@ public abstract class RepositoryStub {
                 try {
                     props.load(is);
                 } catch (IOException e) {
-                    throw new RepositoryStubException("Exception reading "
-                            + STUB_IMPL_PROPS + ": " + e.toString());
+                    throw new RepositoryStubException(
+                            "Exception reading " + STUB_IMPL_PROPS, e);
                 }
             }
         }
@@ -214,18 +213,8 @@ public abstract class RepositoryStub {
             Class stubClass = Class.forName(className);
             Constructor constr = stubClass.getConstructor(new Class[]{Properties.class});
             stub = (RepositoryStub) constr.newInstance(new Object[]{props});
-        } catch (ClassCastException e) {
-            throw new RepositoryStubException(e.toString());
-        } catch (NoSuchMethodException e) {
-            throw new RepositoryStubException(e.toString());
-        } catch (ClassNotFoundException e) {
-            throw new RepositoryStubException(e.toString());
-        } catch (InstantiationException e) {
-            throw new RepositoryStubException(e.toString());
-        } catch (IllegalAccessException e) {
-            throw new RepositoryStubException(e.toString());
-        } catch (InvocationTargetException e) {
-            throw new RepositoryStubException(e.toString());
+        } catch (Exception e) {
+            throw new RepositoryStubException(e);
         }
 
         return stub;

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/RepositoryStubException.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/RepositoryStubException.java?rev=1464606&r1=1464605&r2=1464606&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/RepositoryStubException.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/RepositoryStubException.java
Thu Apr  4 15:52:10 2013
@@ -24,4 +24,13 @@ public class RepositoryStubException ext
     public RepositoryStubException(String msg) {
         super(msg);
     }
+
+    public RepositoryStubException(Throwable cause) {
+        super(cause);
+    }
+
+    public RepositoryStubException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-jcr2dav/src/test/java/org/apache/jackrabbit/jcr2dav/RepositoryStubImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2dav/src/test/java/org/apache/jackrabbit/jcr2dav/RepositoryStubImpl.java?rev=1464606&r1=1464605&r2=1464606&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2dav/src/test/java/org/apache/jackrabbit/jcr2dav/RepositoryStubImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2dav/src/test/java/org/apache/jackrabbit/jcr2dav/RepositoryStubImpl.java
Thu Apr  4 15:52:10 2013
@@ -80,8 +80,7 @@ public class RepositoryStubImpl extends 
             try {
                 server.start();
             } catch (Exception e) {
-                e.printStackTrace();
-                throw new RepositoryStubException(e.getMessage());
+                throw new RepositoryStubException(e);
             }
         }
 
@@ -90,8 +89,7 @@ public class RepositoryStubImpl extends 
                 client = JcrUtils.getRepository(
                         "http://localhost:" + connector.getLocalPort() + "/");
             } catch (Exception e) {
-                e.printStackTrace();
-                throw new RepositoryStubException(e.getMessage());
+                throw new RepositoryStubException(e);
             }
         }
 

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2dav/RepositoryStubImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2dav/RepositoryStubImpl.java?rev=1464606&r1=1464605&r2=1464606&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2dav/RepositoryStubImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2dav/RepositoryStubImpl.java
Thu Apr  4 15:52:10 2013
@@ -72,7 +72,7 @@ public class RepositoryStubImpl extends 
                     }
                 });
             } catch (Exception e) {
-                throw new RepositoryStubException(e.toString());
+                throw new RepositoryStubException(e);
             }
         }
         return repository;

Modified: jackrabbit/trunk/jackrabbit-spi2jcr/src/test/java/org/apache/jackrabbit/spi2jcr/RepositoryStubImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2jcr/src/test/java/org/apache/jackrabbit/spi2jcr/RepositoryStubImpl.java?rev=1464606&r1=1464605&r2=1464606&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2jcr/src/test/java/org/apache/jackrabbit/spi2jcr/RepositoryStubImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2jcr/src/test/java/org/apache/jackrabbit/spi2jcr/RepositoryStubImpl.java
Thu Apr  4 15:52:10 2013
@@ -63,9 +63,7 @@ public class RepositoryStubImpl extends 
                     }
                 });
             } catch (RepositoryException e) {
-                RepositoryStubException ex = new RepositoryStubException(e.getMessage());
-                ex.initCause(e);
-                throw ex;
+                throw new RepositoryStubException(e);
             }
         }
         return repo;



Mime
View raw message