You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-dev@jakarta.apache.org by Sylvain Pasche <sy...@epfl.ch> on 2003/01/22 22:17:40 UTC
[patch] SyntheticRepository
Hello,
Well, I had some mysterious ClassNotFound exceptions untill I applied
the following fix. I don't know if it is the right place to put it,
but at least it works for me now ;-)
Cheers,
Sylvain
*** SyntheticRepository.java 2003-01-09 19:01:50.000000000 +0100
--- SyntheticRepository.java 2003-01-22 21:53:47.000000000 +0100
***************
*** 121,160 ****
--- 121,164 ----
* Remove class from repository
*/
public void removeClass(JavaClass clazz) {
_loadedClasses.remove(clazz.getClassName());
}
/**
* Find an already defined (cached) JavaClass object by name.
*/
public JavaClass findClass(String className) {
return (JavaClass)_loadedClasses.get(className);
}
/**
* Load a JavaClass object for the given class name using
* the CLASSPATH environment variable.
*/
public JavaClass loadClass(String className)
throws ClassNotFoundException
{
+ if (_loadedClasses.containsKey(className))
+ return (JavaClass) _loadedClasses.get(className);
+
if(className == null || className.equals("")) {
throw new IllegalArgumentException("Invalid class name " + className);
}
className = className.replace('/', '.'); // Just in case, canonical form
try {
return loadClass(_path.getInputStream(className), className);
} catch(IOException e) {
throw new ClassNotFoundException("Exception while looking for class " +
className + ": " + e.toString());
}
}
/**
* Try to find class source via getResourceAsStream().
* @see Class
* @return JavaClass object for given runtime class
*/
public JavaClass loadClass(Class clazz) throws ClassNotFoundException {
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>