private InputStream createAutoDetectedStream ( final String defaultFileName ) throws IOException { try { Validate . notNull ( wroFile , "Cannot call this method if wroFile is null!" ) ; if ( autoDetectWroFile ) { final File file = new File ( wroFile . getParentFile ( ) , defaultFileName ) ; LOG . debug ( "\tloading autodetected wro file: " + file ) ; return new FileInputStream ( file ) ; } LOG . debug ( "loading wroFile: " + wroFile ) ; return new FileInputStream ( wroFile ) ; } catch ( final FileNotFoundException e ) { // When auto detect is turned on, do not skip trying.. because the auto detection assume that the wro file name // can be wrong. if ( autoDetectWroFile ) { throw e ; } throw new WroRuntimeException ( "The wroFile doesn't exist. Skip trying with other wro model factories" , e ) ; } }
Handles the resource model auto detection .