public JavaClass lookupClass(String className) throws ClassNotFoundException {
  if (classesThatCantBeFound.contains(className)) {
    throw new ClassNotFoundException("Error while looking for class " + className + ": class not found");
  }
  String resourceName=className.replace('.','/') + ".class";
  InputStream in=null;
  boolean parsedClass=false;
  try {
    in=getInputStreamForResource(resourceName);
    if (in == null) {
      classesThatCantBeFound.add(className);
      throw new ClassNotFoundException("Error while looking for class " + className + ": class not found");
    }
    ClassParser classParser=new ClassParser(in,resourceName);
    JavaClass javaClass=classParser.parse();
    parsedClass=true;
    return javaClass;
  }
 catch (  IOException e) {
    classesThatCantBeFound.add(className);
    throw new ClassNotFoundException("IOException while looking for class " + className,e);
  }
 finally {
    if (in != null && !parsedClass) {
      try {
        in.close();
      }
 catch (      IOException ignore) {
      }
    }
  }
}

public JavaClass lookupClass ( String className ) throws ClassNotFoundException { if ( classesThatCantBeFound . contains ( className ) ) { throw new ClassNotFoundException ( "Error while looking for class " + className + ": class not found" ) ; } String resourceName = className . replace ( '.' , '/' ) + ".class" ; InputStream in = null ; boolean parsedClass = false ; try { in = getInputStreamForResource ( resourceName ) ; if ( in == null ) { classesThatCantBeFound . add ( className ) ; throw new ClassNotFoundException ( "Error while looking for class " + className + ": class not found" ) ; } ClassParser classParser = new ClassParser ( in , resourceName ) ; JavaClass javaClass = classParser . parse ( ) ; parsedClass = true ; return javaClass ; } catch ( IOException e ) { classesThatCantBeFound . add ( className ) ; throw new ClassNotFoundException ( "IOException while looking for class " + className , e ) ; } finally { if ( in != null && ! parsedClass ) { try { in . close ( ) ; } catch ( IOException ignore ) { } } } }
look up a class from the classpath .
