( String name )
| 123 | */ |
| 124 | // add some caching for not found classes? |
| 125 | protected Class findClass( String name ) |
| 126 | throws ClassNotFoundException |
| 127 | { |
| 128 | // Deal with this cast somehow... maybe have this class use |
| 129 | // ClassManagerImpl type directly. |
| 130 | // Don't add the method to BshClassManager... it's really an impl thing |
| 131 | ClassManagerImpl bcm = (ClassManagerImpl)getClassManager(); |
| 132 | |
| 133 | // Should we try to load the class ourselves or delegate? |
| 134 | // look for overlay loader |
| 135 | |
| 136 | // Deal with this cast somehow... maybe have this class use |
| 137 | // ClassManagerImpl type directly. |
| 138 | // Don't add the method to BshClassManager... it's really an impl thing |
| 139 | ClassLoader cl = bcm.getLoaderForClass( name ); |
| 140 | |
| 141 | Class c; |
| 142 | |
| 143 | // If there is a designated loader and it's not us delegate to it |
| 144 | if ( cl != null && cl != this ) |
| 145 | try { |
| 146 | return cl.loadClass( name ); |
| 147 | } catch ( ClassNotFoundException e ) { |
| 148 | throw new ClassNotFoundException( |
| 149 | "Designated loader could not find class: "+e ); |
| 150 | } |
| 151 | |
| 152 | // Let URLClassLoader try any paths it may have |
| 153 | if ( getURLs().length > 0 ) |
| 154 | try { |
| 155 | return super.findClass(name); |
| 156 | } catch ( ClassNotFoundException e ) { |
| 157 | //System.out.println( |
| 158 | // "base loader here caught class not found: "+name ); |
| 159 | } |
| 160 | |
| 161 | |
| 162 | // If there is a baseLoader and it's not us delegate to it |
| 163 | cl = bcm.getBaseLoader(); |
| 164 | |
| 165 | if ( cl != null && cl != this ) |
| 166 | try { |
| 167 | return cl.loadClass( name ); |
| 168 | } catch ( ClassNotFoundException e ) { } |
| 169 | |
| 170 | // Try system loader |
| 171 | return bcm.plainClassForName( name ); |
| 172 | } |
| 173 | |
| 174 | /* |
| 175 | The superclass does something like this |
no test coverage detected