package baoying.java.lang;public class ExceptionStackPrint {public static void main(String[] args) {/**print exception at B_Ajava.lang.RuntimeException: D_C_B_Aat baoying.java.lang.D_C_B_A.execute(ExceptionStackPrint.java:48)at baoying.java.lang.C_B_A.execute(ExceptionStackPrint.java:41)at baoying.java.lang.B_A.execute(ExceptionStackPrint.java:28)at baoying.java.lang.A.execute(ExceptionStackPrint.java:21)at baoying.java.lang.ExceptionStackPrint.main(ExceptionStackPrint.java:15)*/new A().execute();}}class A{public void execute(){new B_A().execute();}}class B_A{public void execute(){try{new C_B_A().execute();}catch(Throwable t){System.out.println("print exception at B_A");t.printStackTrace();}}}class C_B_A{public void execute(){new D_C_B_A().execute();}}class D_C_B_A{public void execute(){throw new RuntimeException("D_C_B_A");}}
1. Image iconImg = Toolkit.getDefaultToolkit().getImage(url);
2. System.out.println(threadInfo+ " "+ new java.util.Date()+method+" load done:"+imageInCP);
Baoying Thread - 19783394485810 Started
Baoying Thread - 19783394485810:98 wait 30 seconds to let you be ready, and thread will start after sleep
cache: Create from verifier: JarSigningData{hasOnlySignedEntries=true, hasSingleCodeSource=true, hasMissingSignedEntries=false}
cache: Upgrade of entry done
cache: readIndexFile returning success
network: CleanupThread used 1952979 us
Baoying Thread - 19783394485810:98 Fri Jun 12 14:50:57 CST 2015getImageByURL: try to load:/baoying.JPG
Baoying Thread - 19783394485810:98 Fri Jun 12 14:50:57 CST 2015getImageByURL: load url:jar:https://huhuzhu-scs.nott.ime.reuters.com/ptshub/baoying/BaoyingImageShow.jar!/baoying.JPG
network: Cache entry not found [url: http://huhuzhu-scs.nott.ime.reuters.com/crossdomain.xml, version: null]
network: Connecting http://huhuzhu-scs.nott.ime.reuters.com/crossdomain.xml with proxy=DIRECT
network: Connecting http://huhuzhu-scs.nott.ime.reuters.com:80/ with proxy=DIRECT
network: Connecting http://huhuzhu-scs.nott.ime.reuters.com/crossdomain.xml with cookie "63738647932733330794D3=E4F34636C61336A3F6B554; D693E3D38686E6D3E65655F36523964614D683E4041595E4452676F466C5A363D3=A4348516A307F376246553; D693E3D38686E6D3E656550505F3F34656D47334D69595F415642355639407D654=8574E3C644D32364346514; D693E3D38686E6D3E656550505F3F34656D47334D6952375F405F61385057517D4=1426633655C637732795D4; https%3A%2F%2Fhuhuzhu-scs.nott.ime.reuters.com%2Fptshub%2Ftheme=m%3Aid%7Cs%3Areuters%2Cfile%7Cs%3Axtheme-reuters.css"
network: Connecting http://huhuzhu-scs.nott.ime.reuters.com:80/ with proxy=DIRECT
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.access$200(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessController.doPrivileged(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.sun.deploy.net.CrossDomainXML.check(Unknown Source)
at com.sun.deploy.net.CrossDomainXML.check(Unknown Source)
at sun.plugin2.applet.SecurityManagerHelper.checkConnectHelper(Unknown Source)
at sun.plugin2.applet.AWTAppletSecurityManager.checkConnect(Unknown Source)
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getByName(Unknown Source)
at java.net.URLStreamHandler.getHostAddress(Unknown Source)
at java.net.URLStreamHandler.hashCode(Unknown Source)
at java.net.URL.hashCode(Unknown Source)
at sun.net.www.protocol.jar.Handler.hashCode(Unknown Source)
at java.net.URL.hashCode(Unknown Source)
at java.util.HashMap.hash(Unknown Source)
at java.util.HashMap.get(Unknown Source)
at sun.misc.SoftCache.get(Unknown Source)
at sun.awt.SunToolkit.getImageFromHash(Unknown Source)
at sun.awt.SunToolkit.getImage(Unknown Source)
at ImageShowApplet.getImageByURL(ImageShowApplet.java:68)
at ImageShowApplet$1.run(ImageShowApplet.java:37)
at java.lang.Thread.run(Unknown Source)
java.security.AccessControlException: access denied ("java.net.SocketPermission" "huhuzhu-scs.nott.ime.reuters.com" "resolve")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at sun.plugin2.applet.SecurityManagerHelper.checkConnectHelper(Unknown Source)
at sun.plugin2.applet.AWTAppletSecurityManager.checkConnect(Unknown Source)
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getByName(Unknown Source)
at com.sun.deploy.net.CrossDomainXML.addAccess(Unknown Source)
at com.sun.deploy.net.CrossDomainXML.allowNoAccess(Unknown Source)
at com.sun.deploy.net.CrossDomainXML.check(Unknown Source)
at sun.plugin2.applet.SecurityManagerHelper.checkConnectHelper(Unknown Source)
at sun.plugin2.applet.AWTAppletSecurityManager.checkConnect(Unknown Source)
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getByName(Unknown Source)
at java.net.URLStreamHandler.getHostAddress(Unknown Source)
at java.net.URLStreamHandler.hashCode(Unknown Source)
at java.net.URL.hashCode(Unknown Source)
at sun.net.www.protocol.jar.Handler.hashCode(Unknown Source)
at java.net.URL.hashCode(Unknown Source)
at java.util.HashMap.hash(Unknown Source)
at java.util.HashMap.get(Unknown Source)
at sun.misc.SoftCache.get(Unknown Source)
at sun.awt.SunToolkit.getImageFromHash(Unknown Source)
at sun.awt.SunToolkit.getImage(Unknown Source)
at ImageShowApplet.getImageByURL(ImageShowApplet.java:68)
at ImageShowApplet$1.run(ImageShowApplet.java:37)
at java.lang.Thread.run(Unknown Source)
--问题在此:问什么下面这行log能打印出来?按照上面的调用栈,已经明确表示在ImageShowApplet.java:68已经抛出AccessControlException,那么下面的程序应该无法继续执行。线程应该终止。但是程序继续执行,而且还是那个线程。真是百思不得其姐 !
Baoying Thread - 19783394485810:98 Fri Jun 12 14:51:07 CST 2015getImageByURL: load done:/baoying.JPG
Baoying Thread - 19783394485810:98 Fri Jun 12 14:51:07 CST 2015getImageByURL: try to load:/baoying_02.JPG
Baoying Thread - 19783394485810:98 Fri Jun 12 14:51:07 CST 2015getImageByURL: load url:jar:https://huhuzhu-scs.nott.ime.reuters.com/ptshub/baoying/BaoyingImageShow.jar!/baoying_02.JPG
Baoying Thread - 19783394485810:98 Fri Jun 12 14:51:12 CST 2015getImageByURL: load done:/baoying_02.JPG
Baoying Thread - 19783394485810:98 Fri Jun 12 14:51:12 CST 2015getImageByURL: try to load:/baoying_03.JPG
Baoying Thread - 19783394485810:98 Fri Jun 12 14:51:12 CST 2015getImageByURL: load url:jar:https://huhuzhu-scs.nott.ime.reuters.com/ptshub/baoying/BaoyingImageShow.jar!/baoying_03.JPG
Baoying Thread - 19783394485810:98 Fri Jun 12 14:51:16 CST 2015getImageByURL: load done:/baoying_03.JPG
Baoying Thread - 19783394485810:98 re-try the loaded pic baoying_03.JPG
Baoying Thread - 19783394485810:98 Fri Jun 12 14:51:16 CST 2015getImageByURL: try to load:/baoying_03.JPG
Baoying Thread - 19783394485810:98 Fri Jun 12 14:51:16 CST 2015getImageByURL: load url:jar:https://huhuzhu-scs.nott.ime.reuters.com/ptshub/baoying/BaoyingImageShow.jar!/baoying_03.JPG
Baoying Thread - 19783394485810:98 Fri Jun 12 14:51:30 CST 2015getImageByURL: load done:/baoying_03.JPG
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.net.URL;
public class ImageShowApplet extends Applet {
private static final long serialVersionUID = 1L;
Thread t = null;
public void paint(Graphics g) {
g.drawString("Welcome in Java Applet.", 40, 20);
synchronized(this){
if(t == null){
String id = String.valueOf(System.nanoTime());
String threadName = "Baoying Thread - " + id;
t = new Thread(new Runnable(){
public void run(){
long threadID = Thread.currentThread().getId();
String name = Thread.currentThread().getName();
String nameAndID = name +":" + threadID;
System.out.println(nameAndID + " wait 30 seconds to let you be ready, and thread will start after sleep");
try {
Thread.sleep(30 * 1000);
} catch (InterruptedException e) {
System.out.println(nameAndID + " interrupted exception");
e.printStackTrace();
}
getImageByURL("/baoying.JPG",nameAndID);
getImageByURL("/baoying_02.JPG",nameAndID);
getImageByURL("/baoying_03.JPG",nameAndID);
System.out.println(nameAndID + " re-try the loaded pic baoying_03.JPG");
getImageByURL("/baoying_03.JPG",nameAndID);
//getImageByFilename();
}
},threadName);
System.out.println(threadName+" is Created");
t.start();
System.out.println(threadName + " Started");
}
}
}
public void getImageByURL(String imageInCP, String threadInfo){
String method = "getImageByURL:";
System.out.println(threadInfo+ " "+ new java.util.Date()+method+" try to load:"+imageInCP);
URL url = this.getClass().getResource(imageInCP);
if(url == null){
System.out.println(threadInfo+ " "+ new java.util.Date()+method+" null url by:"+imageInCP);
return;
}
System.out.println(threadInfo+ " "+ new java.util.Date()+method+" load url:"+url.toString());
Image iconImg = Toolkit.getDefaultToolkit().getImage(url);
if(iconImg == null){
System.out.println(threadInfo+ " "+ new java.util.Date()+method+" null image by:"+imageInCP);
return;
}
System.out.println(threadInfo+ " "+ new java.util.Date()+method+" load done:"+imageInCP);
}
}
[参考]
Another guy(by eagleanec - 2012-08-21 00:58) with similar trace
https://weblogs.java.net/blog/2008/05/28/java-doodle-crossdomainxml-support
another report with same stack trace
https://community.oracle.com/thread/2179788
还有一个csdn的,无满意回复而结贴
http://bbs.csdn.net/topics/360101851
java.security.AccessControlException: access denied ("java.net.SocketPermission" "huhuzhu-scs.nott.ime.reuters.com" "resolve") |
Baoying Thread - 19783394485810:98 Fri Jun 12 14:50:57 CST 2015getImageByURL: load url:jar:https://huhuzhu-scs.nott.ime.reuters.com/ptshub/baoying/BaoyingImageShow.jar!/baoying.JPG |