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 22347] New: - java task with BufferedReader hangs
Date Tue, 12 Aug 2003 12:30:02 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22347>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22347

java task with BufferedReader hangs

           Summary: java task with BufferedReader hangs
           Product: Ant
           Version: 1.5
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: literakl@systinet.com


Hi,

if I execute java task with following code, ant hangs and I have to kill it.

<pre>
    public static String readString(String message, String defaultValue) {
        System.out.print(message+" ["+defaultValue+"]: ");
        String input = null;

        try {
            BufferedReader reader = new BufferedReader(new
InputStreamReader(System.in));
            input = reader.readLine();
            if ( input==null || input.length()==0 )
                return defaultValue;
            else
                return input;
        } catch (IOException e) {
            System.err.println("Cannot read from standard input! Reason:
"+e.getMessage());
            return defaultValue;
        }
    }
</pre>

It doesn't print to standard output anything (neither argument message). I may
press enter key many times, it add new line to screen, but the method doesn't
return. It block forever and I have to kill it :-(

It seems obvious, that I am not not first man who encountered this issue. See
following site:

http://bobcat.webappcabaret.net/javachina/faq/ant_01.htm#ant_adv_Q10

Any idea, why does this happen and how to avoid it? Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message