cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amania...@apache.org
Subject svn commit: r558280 - in /cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src: main/java/org/apache/cayenne/remote/ main/java/org/apache/cayenne/remote/service/ test/java/org/apache/cayenne/remote/
Date Sat, 21 Jul 2007 09:37:28 GMT
Author: amaniatis
Date: Sat Jul 21 02:37:27 2007
New Revision: 558280

URL: http://svn.apache.org/viewvc?view=rev&rev=558280
Log:
Fix problem created in commit 555549 which would sometimes allow an unserializable exception
(eg. from Derby) to be propagated to the ROP client, causing a problem.

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/BootstrapMessage.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/ClientMessage.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/QueryMessage.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/SyncMessage.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/service/BaseRemoteService.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/remote/MockMessage.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/BootstrapMessage.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/BootstrapMessage.java?view=diff&rev=558280&r1=558279&r2=558280
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/BootstrapMessage.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/BootstrapMessage.java
Sat Jul 21 02:37:27 2007
@@ -27,6 +27,9 @@
  */
 public class BootstrapMessage implements ClientMessage {
 
+    /**
+     * Returns a description of the type of message. In this case always "Bootstrap".
+     */
     public String toString() {
         return "Bootstrap";
     }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/ClientMessage.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/ClientMessage.java?view=diff&rev=558280&r1=558279&r2=558280
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/ClientMessage.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/ClientMessage.java
Sat Jul 21 02:37:27 2007
@@ -29,9 +29,4 @@
  */
 public interface ClientMessage extends Serializable {
 
-    /**
-     * Returns a description of the type of message.
-     */
-    public String toString();
-    
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/QueryMessage.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/QueryMessage.java?view=diff&rev=558280&r1=558279&r2=558280
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/QueryMessage.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/QueryMessage.java
Sat Jul 21 02:37:27 2007
@@ -45,6 +45,9 @@
         return query;
     }
 
+    /**
+     * Returns a description of the type of message. In this case always "Query".
+     */
     public String toString() {
         return "Query";
     }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/SyncMessage.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/SyncMessage.java?view=diff&rev=558280&r1=558279&r2=558280
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/SyncMessage.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/SyncMessage.java
Sat Jul 21 02:37:27 2007
@@ -71,6 +71,10 @@
         return senderChanges;
     }
 
+    /**
+     * Returns a description of the type of message.
+     * Possibilities are "flush-sync", "flush-cascade-sync", "rollback-cascade-sync" or "unknown-sync".
+     */
     public String toString() {
         switch (type) {
             case DataChannel.FLUSH_NOCASCADE_SYNC:

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/service/BaseRemoteService.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/service/BaseRemoteService.java?view=diff&rev=558280&r1=558279&r2=558280
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/service/BaseRemoteService.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/remote/service/BaseRemoteService.java
Sat Jul 21 02:37:27 2007
@@ -19,6 +19,8 @@
 
 package org.apache.cayenne.remote.service;
 
+import java.io.ByteArrayOutputStream;
+import java.io.PrintWriter;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
@@ -154,20 +156,26 @@
             th = Util.unwindException(th);
             logObj.info("error processing message", th);
 
-            // throw exception that will likely be propagated to the client...
-            // recast the exception to a guaranteed serializable form
-
-            StringBuffer buffer = new StringBuffer();
-            buffer.append("Exception processing message ")
-                .append(message.getClass().getName())
-                .append(" of type ").append(message.toString());
-
+            // This exception will probably be propagated to the client.
+            // Recast the exception to a serializable form.
+            ByteArrayOutputStream causeMessageStream = new ByteArrayOutputStream();
+            PrintWriter causeMessage = new PrintWriter(causeMessageStream);
+            
             String exceptionText = th.getLocalizedMessage();
             if (exceptionText != null) {
-                buffer.append(". Root cause: ").append(exceptionText);
+                causeMessage.print(exceptionText);
+                causeMessage.print(System.getProperty("line.separator"));
             }
 
-            throw new CayenneRuntimeException(buffer.toString(), th);
+            th.printStackTrace(causeMessage);
+            Exception cause = new Exception(causeMessageStream.toString());
+            
+            StringBuffer wrapperMessage = new StringBuffer();
+            wrapperMessage.append("Exception processing message ")
+                .append(message.getClass().getName())
+                .append(" of type ").append(message.toString());
+            
+            throw new CayenneRuntimeException(wrapperMessage.toString(), cause);
         }
     }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/remote/MockMessage.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/remote/MockMessage.java?view=diff&rev=558280&r1=558279&r2=558280
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/remote/MockMessage.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/remote/MockMessage.java
Sat Jul 21 02:37:27 2007
@@ -40,6 +40,9 @@
         return lastChannel;
     }
     
+    /**
+     * Returns a description of the type of message. In this case always "Mock message".
+     */
     public String toString() {
         return "Mock message";
     }



Mime
View raw message