Author: remm Date: Wed Feb 14 16:23:18 2007 New Revision: 507751 URL: http://svn.apache.org/viewvc?view=rev&rev=507751 Log: - Remove dead code. - Move the special purpose sys.out capture to an inner class of the Ant compiler.
Removed: tomcat/tc6.0.x/trunk/java/org/apache/jasper/util/FastDateFormat.java tomcat/tc6.0.x/trunk/java/org/apache/jasper/util/Queue.java tomcat/tc6.0.x/trunk/java/org/apache/jasper/util/SimplePool.java tomcat/tc6.0.x/trunk/java/org/apache/jasper/util/SystemLogHandler.java Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/AntCompiler.java tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/AntCompiler.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/AntCompiler.java?view=diff&rev=507751&r1=507750&r2=507751 ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/AntCompiler.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/AntCompiler.java Wed Feb 14 16:23:18 2007 @@ -17,13 +17,14 @@ package org.apache.jasper.compiler; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileNotFoundException; +import java.io.IOException; import java.io.PrintStream; import java.util.StringTokenizer; import org.apache.jasper.JasperException; -import org.apache.jasper.util.SystemLogHandler; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DefaultLogger; import org.apache.tools.ant.Project; @@ -275,4 +276,197 @@ } + protected static class SystemLogHandler extends PrintStream { + + + // ----------------------------------------------------------- Constructors + + + /** + * Construct the handler to capture the output of the given steam. + */ + public SystemLogHandler(PrintStream wrapped) { + super(wrapped); + this.wrapped = wrapped; + } + + + // ----------------------------------------------------- Instance Variables + + + /** + * Wrapped PrintStream. + */ + protected PrintStream wrapped = null; + + + /** + * Thread <-> PrintStream associations. + */ + protected static ThreadLocal streams = new ThreadLocal(); + + + /** + * Thread <-> ByteArrayOutputStream associations. + */ + protected static ThreadLocal data = new ThreadLocal(); + + + // --------------------------------------------------------- Public Methods + + + public PrintStream getWrapped() { + return wrapped; + } + + /** + * Start capturing thread's output. + */ + public static void setThread() { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + data.set(baos); + streams.set(new PrintStream(baos)); + } + + + /** + * Stop capturing thread's output and return captured data as a String. + */ + public static String unsetThread() { + ByteArrayOutputStream baos = + (ByteArrayOutputStream) data.get(); + if (baos == null) { + return null; + } + streams.set(null); + data.set(null); + return baos.toString(); + } + + + // ------------------------------------------------------ Protected Methods + + + /** + * Find PrintStream to which the output must be written to. + */ + protected PrintStream findStream() { + PrintStream ps = (PrintStream) streams.get(); + if (ps == null) { + ps = wrapped; + } + return ps; + } + + + // ---------------------------------------------------- PrintStream Methods + + + public void flush() { + findStream().flush(); + } + + public void close() { + findStream().close(); + } + + public boolean checkError() { + return findStream().checkError(); + } + + protected void setError() { + //findStream().setError(); + } + + public void write(int b) { + findStream().write(b); + } + + public void write(byte[] b) + throws IOException { + findStream().write(b); + } + + public void write(byte[] buf, int off, int len) { + findStream().write(buf, off, len); + } + + public void print(boolean b) { + findStream().print(b); + } + + public void print(char c) { + findStream().print(c); + } + + public void print(int i) { + findStream().print(i); + } + + public void print(long l) { + findStream().print(l); + } + + public void print(float f) { + findStream().print(f); + } + + public void print(double d) { + findStream().print(d); + } + + public void print(char[] s) { + findStream().print(s); + } + + public void print(String s) { + findStream().print(s); + } + + public void print(Object obj) { + findStream().print(obj); + } + + public void println() { + findStream().println(); + } + + public void println(boolean x) { + findStream().println(x); + } + + public void println(char x) { + findStream().println(x); + } + + public void println(int x) { + findStream().println(x); + } + + public void println(long x) { + findStream().println(x); + } + + public void println(float x) { + findStream().println(x); + } + + public void println(double x) { + findStream().println(x); + } + + public void println(char[] x) { + findStream().println(x); + } + + public void println(String x) { + findStream().println(x); + } + + public void println(Object x) { + findStream().println(x); + } + + } + } Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java?view=diff&rev=507751&r1=507750&r2=507751 ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java Wed Feb 14 16:23:18 2007 @@ -24,12 +24,11 @@ import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.jsp.JspApplicationContext; -import javax.servlet.jsp.JspFactory; import javax.servlet.jsp.JspEngineInfo; +import javax.servlet.jsp.JspFactory; import javax.servlet.jsp.PageContext; import org.apache.jasper.Constants; -import org.apache.jasper.util.SimplePool; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]