public static URL getUrlFor ( final File aFile ) throws IllegalArgumentException { // Check sanity Validate . notNull ( aFile , "aFile" ) ; try { return aFile . toURI ( ) . normalize ( ) . toURL ( ) ; } catch ( MalformedURLException e ) { throw new IllegalArgumentException ( "Could not retrieve the URL from file [" + getCanonicalPath ( aFile ) + "]" , e ) ; } }
Retrieves the URL for the supplied File . Convenience method which hides exception handling for the operation in question .