https://issues.apache.org/bugzilla/show_bug.cgi?id=46931

           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
        AssignedTo: [email protected]
        ReportedBy: [email protected]


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,
Project.MSG_VERBOSE);
                        out = new PrintStream(new BufferedOutputStream(
                                new FileOutputStream(output.getAbsolutePath(),
append)));
                    }

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

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

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to