ceki        2003/12/06 08:36:01

  Modified:    src/java/org/apache/log4j/spi ThrowableInformation.java
  Log:
  
  o.a.l.spi.ThrowableInformation no longer stores a copy of the 
  throwable it proxies for.
  
  This change has broken ThrowableMatchFilter and PreparedStatementParameter
  classes in the sandbox. 
  
  Even so, the changes are for the better because they are serialization
  independent whereas the previous code only worked before serialization.
  
  Revision  Changes    Path
  1.12      +21 -15    
jakarta-log4j/src/java/org/apache/log4j/spi/ThrowableInformation.java
  
  Index: ThrowableInformation.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-log4j/src/java/org/apache/log4j/spi/ThrowableInformation.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ThrowableInformation.java 20 May 2003 15:09:43 -0000      1.11
  +++ ThrowableInformation.java 6 Dec 2003 16:36:01 -0000       1.12
  @@ -64,37 +64,43 @@
     * correspond the stack trace with the top most entry of the stack
     * corresponding to the second entry of the 'rep' array that is
     * rep[1].
  -  *
  +  * 
  +  * Note that ThrowableInformation does not store the throwable it represents. 
  +  * 
     * @author Ceki Gülcü
     *
     * */
   public class ThrowableInformation implements java.io.Serializable {
     static final long serialVersionUID = -4748765566864322735L;
  -  private transient Throwable throwable;
  +  //private transient Throwable throwable;
  +  
     private String[] rep;
   
     public ThrowableInformation(Throwable throwable) {
  -    this.throwable = throwable;
  +    rep = extractStringRep(throwable);
     }
   
     public ThrowableInformation(String[] rep) {
       this.rep = rep;
     }
   
  -  public Throwable getThrowable() {
  -    return throwable;
  -  }
  + // public Throwable getThrowable() {
  +   // return throwable;
  +  //}
   
  +  public String[] extractStringRep(Throwable throwable) {
  +    VectorWriter vw = new VectorWriter();
  +    throwable.printStackTrace(vw);
  +    String[] extractedRep = vw.toStringArray();
  +    return extractedRep;   
  +  }
  +  
  +  /**
  +   * Retun a clone of the string representation of the exceptopn (throwable)
  +   * that this object represents.
  +   */
     public String[] getThrowableStrRep() {
  -    if (rep != null) {
  -      return (String[]) rep.clone();
  -    } else {
  -      VectorWriter vw = new VectorWriter();
  -      throwable.printStackTrace(vw);
  -      rep = vw.toStringArray();
  -
  -      return rep;
  -    }
  +    return (String[]) rep.clone();
     }
   }
   
  
  
  

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

Reply via email to