public InputStream getResource ( String path ) throws IOException { String localePath = getLocalePath ( path ) ; InputStream in ; // first look for this resource in our default resource bundle for ( ResourceBundle bundle : _default ) { // Try a localized version first. if ( localePath != null ) { in = bundle . getResource ( localePath ) ; if ( in != null ) { return in ; } } // If that didn't work, try generic. in = bundle . getResource ( path ) ; if ( in != null ) { return in ; } } // fallback next to an unpacked resource file File file = getResourceFile ( path ) ; if ( file != null && file . exists ( ) ) { return new FileInputStream ( file ) ; } // if we still didn't find anything, try the classloader; first try a locale-specific file if ( localePath != null ) { in = getInputStreamFromClasspath ( PathUtil . appendPath ( _rootPath , localePath ) ) ; if ( in != null ) { return in ; } } // if we didn't find that, try locale-neutral in = getInputStreamFromClasspath ( PathUtil . appendPath ( _rootPath , path ) ) ; if ( in != null ) { return in ; } // if we still haven't found it, we throw an exception throw new FileNotFoundException ( "Unable to locate resource [path=" + path + "]" ) ; }
Fetches a resource from the local repository .