Author: fhanik
Date: Wed Apr 12 13:58:10 2006
New Revision: 393612
URL: http://svn.apache.org/viewcvs?rev=393612&view=rev
Log:
http://issues.apache.org/bugzilla/show_bug.cgi?id=33368
Already applied to 5.5, backport to 5.0
Fixed provided by Rainer Jung
Modified:
tomcat/jasper/branches/tc5.0.x/jasper2/src/share/org/apache/jasper/util/SystemLogHandler.java
Modified:
tomcat/jasper/branches/tc5.0.x/jasper2/src/share/org/apache/jasper/util/SystemLogHandler.java
URL:
http://svn.apache.org/viewcvs/tomcat/jasper/branches/tc5.0.x/jasper2/src/share/org/apache/jasper/util/SystemLogHandler.java?rev=393612&r1=393611&r2=393612&view=diff
==============================================================================
---
tomcat/jasper/branches/tc5.0.x/jasper2/src/share/org/apache/jasper/util/SystemLogHandler.java
(original)
+++
tomcat/jasper/branches/tc5.0.x/jasper2/src/share/org/apache/jasper/util/SystemLogHandler.java
Wed Apr 12 13:58:10 2006
@@ -55,13 +55,13 @@
/**
* Thread <-> PrintStream associations.
*/
- protected static Hashtable streams = new Hashtable();
+ protected static ThreadLocal streams = new ThreadLocal();
/**
* Thread <-> ByteArrayOutputStream associations.
*/
- protected static Hashtable data = new Hashtable();
+ protected static ThreadLocal data = new ThreadLocal();
// --------------------------------------------------------- Public Methods
@@ -76,9 +76,8 @@
*/
public static void setThread() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- PrintStream ps = new PrintStream(baos);
- data.put(Thread.currentThread(), baos);
- streams.put(Thread.currentThread(), ps);
+ data.set(baos);
+ streams.set(new PrintStream(baos));
}
@@ -87,12 +86,12 @@
*/
public static String unsetThread() {
ByteArrayOutputStream baos =
- (ByteArrayOutputStream) data.get(Thread.currentThread());
+ (ByteArrayOutputStream) data.get();
if (baos == null) {
return null;
}
- streams.remove(Thread.currentThread());
- data.remove(Thread.currentThread());
+ streams.set(null);
+ data.set(null);
return baos.toString();
}
@@ -104,7 +103,7 @@
* Find PrintStream to which the output must be written to.
*/
protected PrintStream findStream() {
- PrintStream ps = (PrintStream) streams.get(Thread.currentThread());
+ PrintStream ps = (PrintStream) streams.get();
if (ps == null) {
ps = wrapped;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]