protected final boolean tryResource ( String directory , String fileName ) { String path = directory + "/" + fileName ; if ( directory == null ) { path = fileName ; } URL url ; ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; url = loader . getResource ( path ) ; if ( url == null ) { loader = AbstractFileInfo . class . getClassLoader ( ) ; url = loader . getResource ( path ) ; } if ( url == null ) { this . errors . addError ( "could not get Resource URL" ) ; return false ; } this . url = url ; this . fullFileName = FilenameUtils . getName ( fileName ) ; if ( directory != null ) { this . setRootPath = directory ; } return true ; }
Try to locate a file as resource .