protected InputStream loadClasspathResource(String resource, boolean trace)
   {
      ClassLoader loader = Thread.currentThread().getContextClassLoader();
      URL url = loader.getResource(resource);
      if( url == null )
      {
         /* Prefix the simple filename with the schema type patch as this is the
               naming convention for the jboss bundled schemas.
            */
         if( resource.endsWith(".dtd") )
            resource = "dtd/" + resource;
         else if( resource.endsWith(".xsd") )
            resource = "schema/" + resource;
         url = loader.getResource(resource);
      }

      InputStream inputStream = null;
      if( url != null )
      {
         if( trace )
            log.trace(resource+" maps to URL: "+url);
         try
         {
            inputStream = url.openStream();
         }
         catch(IOException e)
         {
            log.debug("Failed to open url stream", e);
         }
      }
      return inputStream;
   }
protected InputStream loadClasspathResource ( String resource , boolean trace ) { ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; URL url = loader . getResource ( resource ) ; if ( url == null ) { if ( resource . endsWith ( ".dtd" ) ) resource = "dtd/" + resource ; else if ( resource . endsWith ( ".xsd" ) ) resource = "schema/" + resource ; url = loader . getResource ( resource ) ; } InputStream inputStream = null ; if ( url != null ) { if ( trace ) log . trace ( resource + " maps to URL: " + url ) ; try { inputStream = url . openStream ( ) ; } catch ( IOException e ) { log . debug ( "Failed to open url stream" , e ) ; } } return inputStream ; }
Look for the resource name on the thread context loader resource path. This
first simply tries the resource name as is, and if not found, the resource
is prepended with either "dtd/" or "schema/" depending on whether the
resource ends in ".dtd" or ".xsd".

@param resource - the classpath resource name of the schema
@param trace - trace level logging flag
@return the resource InputStream if found, null if not found.