ceki 01/03/28 04:58:40 Modified: src/java/org/apache/log4j/spi Makefile Added: src/java/org/apache/log4j/spi ThrowableStrRep.java Log: ThrowableStrRep.java is our internal string representation of throwables. It can be serialized contrary to regular throwables. Revision Changes Path 1.6 +1 -0 jakarta-log4j/src/java/org/apache/log4j/spi/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/spi/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Makefile 2001/03/21 21:34:18 1.5 +++ Makefile 2001/03/28 12:58:39 1.6 @@ -11,6 +11,7 @@ ErrorCode.java\ CategoryFactory.java\ Configurator.java\ + ThrowableStrRep.java\ TriggeringEventEvaluator.java\ SUBDIRS := 1.1 jakarta-log4j/src/java/org/apache/log4j/spi/ThrowableStrRep.java Index: ThrowableStrRep.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software * License version 1.1, a copy of which has been included with this * distribution in the LICENSE.APL file. */ package org.apache.log4j.spi; import java.io.Writer; import java.io.PrintWriter; import java.util.Vector; /** */ public class ThrowableStrRep implements java.io.Serializable { private transient Throwable throwable; private String[] rep; static private VectorWriter vw = new VectorWriter(); public ThrowableStrRep(Throwable throwable) { this.throwable = throwable; } public Throwable getThrowable() { return throwable; } public String[] getThrowableStrRep() { if(rep != null) { return (String[]) rep.clone(); } else { throwable.printStackTrace(vw); rep = vw.toStringArray(); vw.clear(); return rep; } } } class VectorWriter extends PrintWriter { private Vector v; VectorWriter() { super(new NullWriter()); v = new Vector(); } public void println(Object o) { v.add(o.toString()); } // JDK 1.1.x apprenly uses this form of println while in // printStackTrace() public void println(char[] s) { v.add(new String(s)); } public void println(String s) { v.add(s); } public String[] toStringArray() { int len = v.size(); String[] sa = new String[len]; for(int i = 0; i < len; i++) { sa[i] = (String) v.elementAt(i); } return sa; } public void clear() { v.setSize(0); } } class NullWriter extends Writer { public void close() { } public void flush() { } public void write(char[] cbuf, int off, int len) { } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]