If I run the following code in Java 6, there is no problem. If I run it in Java 7, the it hangs after reading and printing parts of the page.
I have posted a bug report, but the bug is closed because they are not able to reproduce the bug (see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7045092).
I am wondering if anyone else gets a problem when running the code.
import java.io.*;
import java.net.URL;
public class HttpReaderBug {
public static void main(String[] args) {
try {
URL url = new URL("http://en.wikipedia.org/wiki/Cancer");
BufferedReader in = new BufferedReader(
new InputStreamReader(url.openStream()));
String line;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
in.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}