Dear Apache Commons IO developers,
I found there might be a close method missing in the source code of test cases, 
which may be an issue.
No patch seems to be applied till revision 1026932.
How do you guys think?

The original code here is:
In io/trunk/src/test/java/org/apache/commons/io/testtools/FileBasedTestCase.java
Line 203-223 (revision 1026932)

protected void checkWrite(OutputStream output) throws Exception {
        try {
            new java.io.PrintStream(output).write(0);
        } catch (Throwable t) {
            throw new AssertionFailedError(
                "The copy() method closed the stream "
                    + "when it shouldn't have. "
                    + t.getMessage());
        }
    }

    protected void checkWrite(Writer output) throws Exception {
        try {
            new java.io.PrintWriter(output).write('a');
        } catch (Throwable t) {
            throw new AssertionFailedError(
                "The copy() method closed the stream "
                    + "when it shouldn't have. "
                    + t.getMessage());
        }
    }

The java.io.PrintWriter is initialized without being closed after use. So does 
the java.io.PrintStream instance.

Thanks &Best regards,
Huxing

Reply via email to