Oliver Zeigermann wrote:
You are right. This exception should have been displayed in logging, but
ResourceManagerException can not handle nested exceptions to be comaptible with Java 1.3. Sorry :(
Need to fix this, but do not know how, maybe incorporating the stack trace in the message...

Fixed this now. Cause will be added to the message itself.


Peter, could you check the patch in for me?

Thanks in advance,

Oliver
Index: ResourceManagerException.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-slide/src/stores/org/apache/slide/store/txfile/rm/ResourceManagerException.java,v
retrieving revision 1.1
diff -u -w -r1.1 ResourceManagerException.java
--- ResourceManagerException.java       9 Oct 2003 09:31:33 -0000       1.1
+++ ResourceManagerException.java       16 Oct 2003 11:50:17 -0000
@@ -1,5 +1,8 @@
 package org.apache.slide.store.txfile.rm;
 
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
 /**
  * Signals any kind of error or failure state in a [EMAIL PROTECTED] ResourceManager}.
  * 
@@ -70,6 +73,16 @@
     protected final int status;
     protected final Object txId;
 
+    protected static final String composeMessage(String msg, int status, Object txId, 
Throwable cause) {
+        String message = composeMessage(msg, status, txId);
+        StringBuffer messageBuffer = new StringBuffer(message);
+        messageBuffer.append("\nCaused by: ");
+        StringWriter sw = new StringWriter();
+        cause.printStackTrace(new PrintWriter(sw));
+        messageBuffer.append(sw.getBuffer());
+        return messageBuffer.toString();
+    }
+    
     protected static final String composeMessage(String msg, int status, Object txId) 
{
         StringBuffer composed = new StringBuffer();
         if (txId != null) {
@@ -144,10 +157,10 @@
     }
 
     protected ResourceManagerException(String message, int status, Object txId, 
Throwable cause) {
-        // FIXME can not do this, as 1.3 Throwable does not allow cause in ctor :( 
+        // XXX can not do this, as 1.3 Throwable does not allow cause in ctor :( 
 //        super(ResourceManagerException.composeMessage(message, status, txId), 
cause);
-        // for now ignore cause
-        super(ResourceManagerException.composeMessage(message, status, txId));
+        // for now format cause by ourselves
+        super(ResourceManagerException.composeMessage(message, status, txId, cause));
         this.status = status;
         this.txId = txId;
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to