(String name, boolean resolve)
| 76 | */ |
| 77 | // todo pejobo70 this could be one of the root causes for issue#34 |
| 78 | public Class loadClass(String name, boolean resolve) |
| 79 | throws ClassNotFoundException |
| 80 | { |
| 81 | if (name.startsWith("java.")) { |
| 82 | return super.loadClass(name, resolve); // prevent SecurityException |
| 83 | } |
| 84 | |
| 85 | /* |
| 86 | Check first for classes loaded through this loader. |
| 87 | The VM will not allow a class to be loaded twice. |
| 88 | */ |
| 89 | Class c = findLoadedClass(name); |
| 90 | if ( c != null ) { |
| 91 | return c; |
| 92 | } |
| 93 | |
| 94 | // This is copied from ClassManagerImpl |
| 95 | // We should refactor this somehow if it sticks around |
| 96 | if ( name.startsWith( ClassManagerImpl.BSH_PACKAGE ) ) { |
| 97 | try { |
| 98 | return bsh.Interpreter.class.getClassLoader().loadClass( name ); |
| 99 | } catch ( ClassNotFoundException e ) { |
| 100 | // ignore |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | /* |
| 105 | Try to find the class using our classloading mechanism. |
| 106 | */ |
| 107 | c = findClass( name ); |
| 108 | |
| 109 | if ( resolve ) { |
| 110 | resolveClass( c ); |
| 111 | } |
| 112 | |
| 113 | return c; |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | Find the correct source for the class... |
no test coverage detected