public URL resolve ( String resource , Class consumer ) { final ClassLoader ccl = Thread . currentThread ( ) . getContextClassLoader ( ) ; final String resourcePath = resolvePath ( resource , consumer ) ; URL contentUrl = null ; if ( ccl != null ) { contentUrl = ccl . getResource ( resourcePath ) ; } if ( contentUrl == null ) { contentUrl = consumer . getResource ( resourcePath ) ; } if ( failOnMissingResource && contentUrl == null ) { throw new AssertionError ( "Resource " + resource + " not found" ) ; } return contentUrl ; }
Resolves a URL of the resource specified using the provided class as hint to start the search . For searching the resource the consumer s classloader is used .