JDK1.6的错误处理确实有了很大的改进

早就听说jdk1.6在错误处理方面有了的改进

今天调试applet时深切的体会到这点,抛出的execption确实更加详细了!

这是在jre1.4中抛出的异常,很难确定错误的原因。

java.io.StreamCorruptedException: invalid stream header   
  at java.io.ObjectInputStream.readStreamHeader(Unknown Source)    
at java.io.ObjectInputStream. < init > (Unknown Source)    
at com.icss.starflow.admin.monitor.applet.ParameterTransfer.obtainObjectFromServlet(ParameterTransfer.java: 75 )    
at com.icss.starflow.admin.monitor.applet.ParameterTransfer. < init > (ParameterTransfer.java: 49 )    
at com.icss.starflow.admin.monitor.applet.ProcessStatusGraphApplet.init(ProcessStatusGraphApplet.java: 57 )    
at sun.applet.AppletPanel.run(Unknown Source)    
at java.lang.Thread.run(Unknown Source)java.lang.NullPointerException   
 at com.icss.starflow.admin.monitor.AppletProcessStatusGraph. < init > (AppletProcessStatusGraph.java: 53 )    
at com.icss.starflow.admin.monitor.applet.ParameterTransfer.obtainAndSetGraph(ParameterTransfer.java: 95 )    
at com.icss.starflow.admin.monitor.applet.ParameterTransfer. < init > (ParameterTransfer.java: 50 )    
at com.icss.starflow.admin.monitor.applet.ProcessStatusGraphApplet.init(ProcessStatusGraphApplet.java: 57 )   
 at sun.applet.AppletPanel.run(Unknown Source)    at java.lang.Thread.run(Unknown Source)

 同样的Exception,下面是jre6.0中如下:非常明显的看出是少了一个jar包,仅凭这点,升级到1.6也是非常必要的

 

java.lang.NoClassDefFoundError: bsh / EvalError
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Unknown Source)
    at java.lang.Class.getDeclaredField(Unknown Source)
    at java.io.ObjectStreamClass.getDeclaredSUID(Unknown Source)
    at java.io.ObjectStreamClass.access$
700 (Unknown Source)
    at java.io.ObjectStreamClass$
2 .run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.io.ObjectStreamClass.
< init > (Unknown Source)
    at java.io.ObjectStreamClass.lookup(Unknown Source)
    at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
    at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
    at java.io.ObjectInputStream.readClassDesc(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at java.util.ArrayList.readObject(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readArray(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readArray(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at java.util.ArrayList.readObject(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at java.util.HashMap.readObject(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at com.icss.starflow.admin.monitor.applet.ParameterTransfer.obtainObjectFromServlet(ParameterTransfer.java:
76 )
    at com.icss.starflow.admin.monitor.applet.ParameterTransfer.
< init > (ParameterTransfer.java: 49 )
    at com.icss.starflow.admin.monitor.applet.ProcessStatusGraphApplet.init(ProcessStatusGraphApplet.java:
57 )
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

你可能感兴趣的:(jdk,exception,jar,applet)