private File fileFromResource ( final String resourceName ) throws IllegalArgumentException { final URL resourceUrl = AccessController . doPrivileged ( GetTcclAction . INSTANCE ) . getResource ( resourceName ) ; Validate . notNull ( resourceUrl , resourceName + " doesn't exist or can't be accessed" ) ; String resourcePath = AccessController . doPrivileged ( GetTcclAction . INSTANCE ) . getResource ( resourceName ) . getFile ( ) ; try { // Have to URL decode the string as the ClassLoader.getResource(String) returns an URL encoded URL resourcePath = URLDecoder . decode ( resourcePath , "UTF-8" ) ; } catch ( UnsupportedEncodingException uee ) { throw new IllegalArgumentException ( uee ) ; } return new File ( resourcePath ) ; }
Gets a resource from the TCCL and returns its file path .