DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37169>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=37169

           Summary: SQLExec.runStatements causes problems for JDK 1.5
           Product: Ant
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: JDK1.5
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: [EMAIL PROTECTED]


We are using the <sql> task to read in a .sql file to populate a database.  One
of the INSERT statements that is used to populate a variable unlimited length
column (declared as "TEXT" for Postgresql) is 1.5 million characters long.

Using Ant 1.6.5 with JDK 1.4, the task completes in a few seconds.  However,
using the same version of Ant with JDK 1.5.0 (build 1.5.0_05-b05), it takes 36
minutes.

After debugging the SQLExec class, it appears that the runStatements method
contains an inefficient line of code.  Line 483 contains this code:

if ((delimiterType.equals(DelimiterType.NORMAL)
                 && sql.toString().endsWith(delimiter))

By using the buffer's toString(), the entire buffer is getting searched (in
addition to unneccessarily creating a new string) instead of using the last line
read to locate the delimiter.

If you change it to:

if ((delimiterType.equals(DelimiterType.NORMAL) 
                 && line.endsWith(delimiter))

the problem is fixed.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to