ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 46931] New: SQL task closes its output even if it is System.out
Date Fri, 27 Mar 2009 19:44:39 GMT

           Summary: SQL task closes its output even if it is System.out
           Product: Ant
           Version: 1.7.1
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks

If not value is specified for outptut attribute of the SQL task it takes
System.out as default output which is correct. But when SQL tasks finishes it
closes its output regardless of what kind of output it uses.
As a result after SQL taks executes there will be no more output from any code
that uses System.out

Here is the source code form 1.7.1 distribution that shows the problem (in
execute() method):
PrintStream out = System.out;
                try {
                    if (output != null) {
                        log("Opening PrintStream to output file " + output,
                        out = new PrintStream(new BufferedOutputStream(
                                new FileOutputStream(output.getAbsolutePath(),

                    // Process all transactions
                    for (Enumeration e = transactions.elements();
                         e.hasMoreElements();) {

                        ((Transaction) e.nextElement()).runTransaction(out);
                        if (!isAutocommit()) {
                            log("Committing transaction", Project.MSG_VERBOSE);
                } finally {
                    FileUtils.close(out); //<<<<---- closes output even if it
is System.out

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

View raw message