What's wrong with Java readline()?

I just updated to OS X 10.6.8 and installed the Java update 1.6.0_26-b03-384.


It appears that BufferedReader.readLine() is broken for reading input lines from the console. readLine() does not terminate with a newline.


This is pretty basic. What's up?


import java.io.*;


/**

This class demonstrates how to read a line of text from the keyboard

*/

class ReadLine{

public static void main(String[] args) throws IOException{

String CurLine = ""; // Line read from standard in


System.out.println("Enter a line of text (type 'quit' to exit): ");

InputStreamReader converter = new InputStreamReader(System.in);

BufferedReader in = new BufferedReader(converter);


while (!(CurLine.equals("quit"))){

CurLine = in.readLine();


if (!(CurLine.equals("quit"))){

System.out.println("You typed: " + CurLine);

}

}

}

}

Posted on Aug 29, 2011 11:34 AM

Reply
1 reply

Aug 29, 2011 1:45 PM in response to Tom Coleman

As it turns out, there's nothing wrong with ReadLine(), the problem was Ant 1.8.2.


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


The Apache distribution is dated late 2010. The Apple version of 1.8.2 states that it was compiled on June 3, 2011, but if Apple built from the distribution and not from the corrected svn trunk that would explain it.


My work-around was to install and link ant 1.8.1.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

What's wrong with Java readline()?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.