incubator-kato-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From monte...@apache.org
Subject svn commit: r886245 - /incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClassLoader.java
Date Wed, 02 Dec 2009 18:39:11 GMT
Author: monteith
Date: Wed Dec  2 18:39:10 2009
New Revision: 886245

URL: http://svn.apache.org/viewvc?rev=886245&view=rev
Log:
Fix problem whereby some classes weren't appearing as defined classes in JavaClassLoader.

Modified:
    incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClassLoader.java

Modified: incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClassLoader.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClassLoader.java?rev=886245&r1=886244&r2=886245&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClassLoader.java
(original)
+++ incubator/kato/trunk/org.apache.kato/kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClassLoader.java
Wed Dec  2 18:39:10 2009
@@ -24,7 +24,7 @@
 
 public class JClassLoader implements JavaClassLoader {
 
-	private List<JavaClass> cachedClasses=null;
+	private List<JavaClass> cachedClasses=new LinkedList<JavaClass>();
 	private List<JavaClass> definedClasses = null;
 	public JObject obj = null;
 	
@@ -36,16 +36,8 @@
 		return null;
 	}
 
-	public void addClass(JClass c) {
-		if(cachedClasses==null) cachedClasses=new LinkedList<JavaClass>();
-		if(definedClasses==null) definedClasses=new LinkedList<JavaClass>();
-		
-		cachedClasses.add(c);
-		 
-		// If this class is defined by this loader, store it here.
-		if (c.classloader == this) {
-			definedClasses.add(c);
-		}
+	public void addClass(JClass c) {				
+		cachedClasses.add(c);		
 	}
 
 	@Override
@@ -56,7 +48,19 @@
 
 	@Override
 	public List<JavaClass> getDefinedClasses() {
-		if(definedClasses==null) definedClasses=new LinkedList<JavaClass>();
+		if(definedClasses==null) {
+			definedClasses=new LinkedList<JavaClass>();
+			for(JavaClass clazz : cachedClasses) {
+				try {
+					if (this == clazz.getClassLoader()) {
+						definedClasses.add(clazz);
+					}
+				} catch (CorruptDataException e) {
+					e.printStackTrace();
+				}
+			}
+		}
+		
 		return definedClasses;
 	}
 



Mime
View raw message