Revision: 5331
          http://jnode.svn.sourceforge.net/jnode/?rev=5331&view=rev
Author:   crawley
Date:     2009-04-21 12:49:45 +0000 (Tue, 21 Apr 2009)

Log Message:
-----------
Fix to make the top stack frame appear in system exceptions; e.g. NPEs.

Modified Paths:
--------------
    trunk/core/src/core/org/jnode/vm/scheduler/VmThread.java

Modified: trunk/core/src/core/org/jnode/vm/scheduler/VmThread.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/scheduler/VmThread.java    2009-04-21 
05:26:49 UTC (rev 5330)
+++ trunk/core/src/core/org/jnode/vm/scheduler/VmThread.java    2009-04-21 
12:49:45 UTC (rev 5331)
@@ -1268,6 +1268,7 @@
         final VmProcessor proc = VmProcessor.current();
         final VmStackReader reader = proc.getArchitecture().getStackReader();
         final VmStackFrame[] mt;
+        boolean inSystemException = false;
         // Address lastIP = null;
         if (current.isInSystemException()) {
             proc.disableReschedule(false);
@@ -1278,6 +1279,7 @@
             } finally {
                 proc.enableReschedule(false);
             }
+            inSystemException = true;
         } else if (current == proc.getCurrentThread()) {
             final Address curFrame = VmMagic.getCurrentFrame();
             mt = reader.getVmStackTrace(reader.getPrevious(curFrame), reader
@@ -1294,12 +1296,12 @@
         }
         final int cnt = (mt == null) ? 0 : mt.length;
 
-        VmType lastClass = null;
+        VmType<?> lastClass = null;
 
-        // skip the first element which is VMThrowable.fillInStackTrace()
-        int i = 1;
+        // skip the first element which is VMThrowable.fillInStackTrace() ...
+        // unless this is a system exception 
+        int i = inSystemException ? 0 : 1;
         while (i < cnt) {
-
             final VmStackFrame f = mt[i];
             if (f == null) {
                 break;
@@ -1313,9 +1315,8 @@
                 break;
             }
             final VmType<?> sClass = vmClass.getSuperClass();
-            if ((lastClass != null) && (sClass != lastClass)
-                && (vmClass != lastClass)) {
-                break;
+            if (lastClass != null && sClass != lastClass && vmClass != 
lastClass) {
+                break; 
             }
             final String mname = method.getName();
             if (mname == null) {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Jnode-svn-commits mailing list
Jnode-svn-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jnode-svn-commits

Reply via email to