If you are interested you can run the following code on your machine:
public class JavaRunHang {
public static void main(String[] args) {
System.out.println("Test:");
double d = Double.parseDouble("2.2250738585072012e-308");
System.out.println("Value: " + d);
}
}
Compile this program and run it; the program will hang.
public class JavaCompileHang {
public static void main(String[] args) {
double d = 2.2250738585072012e-308;
System.out.println("Value: " + d);
}
}
And compiling the code above will get your IDE hang.
It turns out to be a security hole for both Sun JDK and Open JDK (http://security-tracker.debian.org/tracker/CVE-2010-4476). This can be used in DOS attack. I’m still seeing if this will affect our apps. Lucky that it's not Long.parseLong.
顺便说一点,我1.6的jdk,第一次被hang住以后,第二次再运行的话,编译(执行javac)就被hang住了,cpu飙升满了。