[kaffe] CVS kaffe (robilad): Fix for getClassContext

Kaffe CVS cvs-commits at kaffe.org
Sun Dec 5 16:19:36 PST 2004


PatchSet 5544 
Date: 2004/12/06 00:15:30
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Fix for getClassContext

2004-12-05  Mark Wielaard  <mark at klomp.org>

        * libraries/javalib/java/lang/VMSecurityManager.java
        (getClassContext): Cleanup returned stack.

Members: 
	ChangeLog:1.3090->1.3091 
	libraries/javalib/java/lang/VMSecurityManager.java:1.2->1.3 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3090 kaffe/ChangeLog:1.3091
--- kaffe/ChangeLog:1.3090	Sun Dec  5 22:43:25 2004
+++ kaffe/ChangeLog	Mon Dec  6 00:15:30 2004
@@ -1,3 +1,8 @@
+2004-12-05  Mark Wielaard  <mark at klomp.org>
+
+	* libraries/javalib/java/lang/VMSecurityManager.java
+	(getClassContext): Cleanup returned stack.
+
 2004-12-05  Dalibor Topic  <robilad at kaffe.org>
 
 	* test/regression/ProcessClassInst.java,
Index: kaffe/libraries/javalib/java/lang/VMSecurityManager.java
diff -u kaffe/libraries/javalib/java/lang/VMSecurityManager.java:1.2 kaffe/libraries/javalib/java/lang/VMSecurityManager.java:1.3
--- kaffe/libraries/javalib/java/lang/VMSecurityManager.java:1.2	Wed Apr  7 21:11:06 2004
+++ kaffe/libraries/javalib/java/lang/VMSecurityManager.java	Mon Dec  6 00:15:33 2004
@@ -58,7 +58,19 @@
    * @return an array of the declaring classes of each stack frame
    */
   static Class[] getClassContext() {
-    return (ThreadStack.getClassStack());
+    Class[] rawStack = ThreadStack.getClassStack();
+    int i = 0;
+    while (i < rawStack.length
+	   && (rawStack[i] == ThreadStack.class
+	       || rawStack[i] == VMSecurityManager.class
+	       || rawStack[i] == SecurityManager.class))
+      i++;
+
+    Class[] stack = new Class[rawStack.length - i];
+    for (int j = 0; j < stack.length; j++, i++)
+      stack[j] = rawStack[i];
+
+    return stack;
   }
 
   /**




More information about the kaffe mailing list