M201370367 / beanshell2

Automatically exported from code.google.com/p/beanshell2
0 stars 1 forks source link

revision #13 broke bsh-core #49

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
After the cleanups in rev. #13, bsh-core built by "ant jarcore" is unusable, 
because BshClassManager now depends on BshClassManagerImpl, which is not 
available in Core.

$ java -jar bsh-core-2.1b3.jar

Exception in thread "main" java.lang.NoClassDefFoundError: 
bsh/classpath/ClassManagerImpl
    at bsh.Interpreter.<init>(Interpreter.java:190)
    at bsh.Interpreter.<init>(Interpreter.java:223)
    at bsh.Interpreter.<init>(Interpreter.java:229)
    at bsh.Interpreter.main(Interpreter.java:411)
Caused by: java.lang.ClassNotFoundException: bsh.classpath.ClassManagerImpl
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    ... 4 more

Here is the particular code change:

@@ -137,19 +135,9 @@
        {
                BshClassManager manager;

-               // Do we have the necessary jdk1.2 packages and optional 
package?
-               if ( Capabilities.classExists("java.lang.ref.WeakReference") 
-                       && Capabilities.classExists("java.util.HashMap") 
-                       && 
Capabilities.classExists("bsh.classpath.ClassManagerImpl") 
-               ) 
-                       try {
-                               // Try to load the module
-                               // don't refer to it directly here or we're 
dependent upon it
-                               Class clas = Class.forName( 
"bsh.classpath.ClassManagerImpl" );
-                               manager = (BshClassManager)clas.newInstance();
-                       } catch ( Exception e ) {
-                               throw new InterpreterError("Error loading 
classmanager: "+e);
-                       }
+               // Do we have the optional package?
+               if ( Capabilities.classExists("bsh.classpath.ClassManagerImpl") 
) 
+                       manager = new bsh.classpath.ClassManagerImpl();
                else 
                        manager = new BshClassManager();

The java package checks can be probably removed, but the rest of the patch 
should be reverted to make bsh-core usable.

Original issue reported on code.google.com by makov...@gmail.com on 3 Jun 2011 at 5:43

GoogleCodeExporter commented 9 years ago
bsh-core exception fix

Original comment by makov...@gmail.com on 4 Jun 2011 at 8:23

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r81.

Original comment by pejob...@gmail.com on 5 Jul 2011 at 2:59

GoogleCodeExporter commented 9 years ago
Thx for the report and attached patch

Original comment by pejob...@gmail.com on 5 Jul 2011 at 3:13

GoogleCodeExporter commented 9 years ago

Original comment by pejob...@gmail.com on 20 Oct 2011 at 7:12