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: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to