jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cko...@apache.org
Subject svn commit: r779040 - in /jackrabbit/trunk/jackrabbit-jca/src: main/java/org/apache/jackrabbit/jca/JCARepositoryHandle.java test/java/org/apache/jackrabbit/jca/test/ConnectionFactoryTest.java
Date Wed, 27 May 2009 07:36:51 GMT
Author: ckoell
Date: Wed May 27 07:36:50 2009
New Revision: 779040

URL: http://svn.apache.org/viewvc?rev=779040&view=rev
Log:
JCR-1597: JCARepositoryHandle.login(...) methods never throw NoSuchWorkspaceException

Modified:
    jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryHandle.java
    jackrabbit/trunk/jackrabbit-jca/src/test/java/org/apache/jackrabbit/jca/test/ConnectionFactoryTest.java

Modified: jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryHandle.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryHandle.java?rev=779040&r1=779039&r2=779040&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryHandle.java
(original)
+++ jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryHandle.java
Wed May 27 07:36:50 2009
@@ -73,6 +73,9 @@
                     mcf, new JCAConnectionRequestInfo(creds, workspace));
         } catch (ResourceException e) {
             Throwable cause = e.getCause();
+            if (cause == null) {
+                cause = e.getLinkedException();
+            }
             if (cause instanceof LoginException) {
                 throw (LoginException) cause;
             } else if (cause instanceof NoSuchWorkspaceException) {

Modified: jackrabbit/trunk/jackrabbit-jca/src/test/java/org/apache/jackrabbit/jca/test/ConnectionFactoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jca/src/test/java/org/apache/jackrabbit/jca/test/ConnectionFactoryTest.java?rev=779040&r1=779039&r2=779040&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jca/src/test/java/org/apache/jackrabbit/jca/test/ConnectionFactoryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jca/src/test/java/org/apache/jackrabbit/jca/test/ConnectionFactoryTest.java
Wed May 27 07:36:50 2009
@@ -16,17 +16,19 @@
  */
 package org.apache.jackrabbit.jca.test;
 
-import org.apache.jackrabbit.api.XASession;
-import org.apache.jackrabbit.jca.JCAConnectionRequestInfo;
-import org.apache.jackrabbit.jca.JCARepositoryHandle;
-import org.apache.jackrabbit.jca.JCASessionHandle;
+import java.io.Serializable;
+import java.util.HashSet;
 
+import javax.jcr.NoSuchWorkspaceException;
 import javax.jcr.Repository;
 import javax.jcr.Session;
 import javax.naming.Referenceable;
 import javax.resource.spi.ManagedConnection;
-import java.io.Serializable;
-import java.util.HashSet;
+
+import org.apache.jackrabbit.api.XASession;
+import org.apache.jackrabbit.jca.JCAConnectionRequestInfo;
+import org.apache.jackrabbit.jca.JCARepositoryHandle;
+import org.apache.jackrabbit.jca.JCASessionHandle;
 
 /**
  * This case executes tests on the connection factory.
@@ -118,5 +120,18 @@
         assertTrue(session instanceof XASession);
         session.logout();
     }
+    
+    /**
+     * Tests if a NoSuchWorkspaceException is thrown if a wrong workspace name is given to
login
+     */
+    public void testExceptionHandling() throws Exception {
+        Object cf = mcf.createConnectionFactory();
+        Repository repository = (Repository) cf;
+        try {
+            repository.login(JCR_SUPERUSER, "xxx");
+        } catch (Exception e) {
+            assertTrue(e instanceof NoSuchWorkspaceException);
+        }
+    }
 
 }



Mime
View raw message