ceki 2002/10/23 00:30:53
Modified: src/java/org/apache/log4j/xml Tag: v1_2-branch
Log4jEntityResolver.java
Log:
Further simplified Log4jEntityResolver such that InputStream returned
by clazz.getResourceAsStream("/org/apache/log4j/xml/log4j.dtd") is
simply handed to InputSource() constructor instead of copying the
InputStream to a ByteArrayInputStream and then passing that to the
constructor.
The previous code was inspired from bug report #3058. See
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3058 for
details. The current code is just what Paul Austin supplied.
I also removed my name from the authors list since my contribution is
now nil.
Revision Changes Path
No revision
No revision
1.1.2.2 +2 -17
jakarta-log4j/src/java/org/apache/log4j/xml/Attic/Log4jEntityResolver.java
Index: Log4jEntityResolver.java
===================================================================
RCS file:
/home/cvs/jakarta-log4j/src/java/org/apache/log4j/xml/Attic/Log4jEntityResolver.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- Log4jEntityResolver.java 22 Oct 2002 17:44:54 -0000 1.1.2.1
+++ Log4jEntityResolver.java 23 Oct 2002 07:30:53 -0000 1.1.2.2
@@ -23,7 +23,6 @@
* file.
*
* @author Paul Austin
- * @auhtor Ceki Gülcü
* */
public class Log4jEntityResolver implements EntityResolver {
@@ -35,22 +34,8 @@
LogLog.error("Could not find [log4j.dtd]. Used [" + clazz.getClassLoader()
+ "] class loader in the search.");
return null;
- }
-
- // Return a copy of log4j.dtd. This solves problems with not
- // being able to remove the log4j.jar file on Windows systems.
- try {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- byte[] buf = new byte[1024];
- int i;
- while((i = in.read(buf)) != -1) {
- bos.write(buf, 0, i);
- }
- in.close();
- return new InputSource(new ByteArrayInputStream(bos.toByteArray()));
- } catch(IOException e) {
- LogLog.error("Could not read log4j.dtd.", e);
- return null;
+ } else {
+ return new InputSource(in);
}
} else {
return null;
--
To unsubscribe, e-mail: <mailto:log4j-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-dev-help@;jakarta.apache.org>