ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 42544] New: - cannot have multiple input tasks with command line redirection
Date Wed, 30 May 2007 00:13:46 GMT
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=42544>.
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=42544

           Summary: cannot have multiple input tasks with command line
                    redirection
           Product: Ant
           Version: 1.7.0
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: davidwbt@gmail.com


In 1.6.2 it used to be possible to invoke an ant script from an external java
program (or shell command) where input values were passed through command line
redirection with each value being terminated by a new line.

In 1.7.0 it appears this functionality has been broken since the
DefaultInputHandler has been modified to use a BufferedReader inside the
handleInput method. The problem with this is that in the first input task, the
bufferedreader will read up to the buffer size (8k), however the
DefaultInputHandler will only consume the first line of this. When the second
input task comes along it will not find anything (i guess maybe if you had very
large input you might find something).

We have a similar problem elsewhere in our code and we handled it by creating a
single static BufferedReader around System.in that was shared. This means that
line 1 can be read by one bit of code, line by the next and so on because they
are using a single BufferedReader.

In 1.6.2 the old code was using DataInputStream.readLine which is deprecated and
probably why the new code uses BufferedReader.

In order to solve my particular problem, I have written an extension of
BufferedReader which uses a single shared BufferReader around System.in. However
this is not a general purpose problem to the solution i think as the
InputHandler should handle the contract of working with the passed in stream.

One possible solution might be to implement a custom LineReader that does not
rely in BufferedReader.

-- 
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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message