cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmen...@apache.org
Subject svn commit: r694800 - in /cayenne/main/trunk: docs/doc/src/main/resources/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/hessian/ framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/hessian/
Date Fri, 12 Sep 2008 20:32:22 GMT
Author: kmenard
Date: Fri Sep 12 13:32:21 2008
New Revision: 694800

URL: http://svn.apache.org/viewvc?rev=694800&view=rev
Log:
Fixed CAY-671: custom exception class for ROP missing session

Applied Tore's patch from the JIRA comments and added an appropriate test.  All CayenneRuntimeExceptions
from the server are not wrapped again on the client.  If this is problematic for people, we
can do it more selectively (e.g., just for MissingSessionException).

Modified:
    cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/hessian/HessianConnection.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/hessian/HessianConnectionTest.java

Modified: cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=694800&r1=694799&r2=694800&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt Fri Sep 12 13:32:21 2008
@@ -17,6 +17,7 @@
 
 CAY-366 Add progress/log view
 CAY-436 In modeler, change default object relationship delete rule
+CAY-671 custom exception class for ROP missing session
 CAY-794 Abstract object entities
 CAY-888 CM Usability: Object Select Query Improvements
 CAY-892 CM Usability: JEdit Syntax to all TextAreas

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/hessian/HessianConnection.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/hessian/HessianConnection.java?rev=694800&r1=694799&r2=694800&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/hessian/HessianConnection.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/hessian/HessianConnection.java
Fri Sep 12 13:32:21 2008
@@ -145,6 +145,9 @@
         try {
             return service.processMessage(message);
         }
+        //catch (CayenneRuntimeException e) {
+        //    throw e;
+        //}
         catch (Throwable th) {
             th = unwindThrowable(th);
             String errorMessage = buildExceptionMessage("Remote error", th);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/hessian/HessianConnectionTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/hessian/HessianConnectionTest.java?rev=694800&r1=694799&r2=694800&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/hessian/HessianConnectionTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/hessian/HessianConnectionTest.java
Fri Sep 12 13:32:21 2008
@@ -20,9 +20,16 @@
 package org.apache.cayenne.remote.hessian;
 
 import org.apache.cayenne.remote.hessian.HessianConnection;
+import org.apache.cayenne.remote.RemoteService;
+import org.apache.cayenne.remote.RemoteSession;
+import org.apache.cayenne.remote.ClientMessage;
+import org.apache.cayenne.remote.service.MissingSessionException;
+import org.apache.cayenne.CayenneRuntimeException;
 
 import junit.framework.TestCase;
 
+import java.rmi.RemoteException;
+
 public class HessianConnectionTest extends TestCase {
 
     public void testConstructor1Arg() {
@@ -39,4 +46,31 @@
         assertEquals("c", c.getPassword());
         assertEquals("d", c.getSharedSessionName());
     }
+
+    public void testMissingSessionException() {
+        // Set up the test objects.  We want to mock out RemoteService.
+        HessianConnection c = new HessianConnection("a");
+        c.service = new RemoteService() {
+            public RemoteSession establishSession() throws RemoteException {
+                return null;
+            }
+
+            public RemoteSession establishSharedSession(String name) throws RemoteException
{
+                return null;
+            }
+
+            public Object processMessage(ClientMessage message) throws RemoteException, Throwable
{
+                throw new MissingSessionException();
+            }
+        };
+
+
+        try {
+            c.doSendMessage(null);
+        }
+        catch (CayenneRuntimeException e) {
+            // Verify that CayenneRuntimeExceptions are not wrapped in another CayenneRuntimeException.
+            assertTrue(e instanceof MissingSessionException);
+        }
+    }
 }



Mime
View raw message