pnever      2003/10/17 05:32:55

  Modified:    src/stores/org/apache/slide/store/txfile/rm
                        ResourceManagerException.java
  Log:
  Patch by Oliver Zeigermann
  
  Revision  Changes    Path
  1.2       +16 -3     
jakarta-slide/src/stores/org/apache/slide/store/txfile/rm/ResourceManagerException.java
  
  Index: ResourceManagerException.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/stores/org/apache/slide/store/txfile/rm/ResourceManagerException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ResourceManagerException.java     9 Oct 2003 09:31:33 -0000       1.1
  +++ ResourceManagerException.java     17 Oct 2003 12:32:55 -0000      1.2
  @@ -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