@Test( expected = IOException.class ) public void testResolve_invalidUrl() throws Exception { DefaultUrlResolver resolver = new DefaultUrlResolver(); resolver.resolve( "localhost" ); }
@Override public ResolvedFile resolve( String url ) throws IOException { ResolvedFile resolvedFile; try { if( url.toLowerCase().startsWith( "file:/" )) { File f = new File( UriUtils.urlToUri( url )); resolvedFile = new ResolvedFile( f, true ); } else { URI uri = UriUtils.urlToUri( url ); InputStream in = uri.toURL().openStream(); File f = File.createTempFile( "rbcf_download_", null ); try { Utils.copyStream( in, f ); } finally { Utils.closeQuietly( in ); } resolvedFile = new ResolvedFile( f, false ); } } catch( Exception e ) { throw new IOException( e ); } return resolvedFile; }
DefaultUrlResolver implements IUrlResolver { @Override public ResolvedFile resolve( String url ) throws IOException { ResolvedFile resolvedFile; try { if( url.toLowerCase().startsWith( "file:/" )) { File f = new File( UriUtils.urlToUri( url )); resolvedFile = new ResolvedFile( f, true ); } else { URI uri = UriUtils.urlToUri( url ); InputStream in = uri.toURL().openStream(); File f = File.createTempFile( "rbcf_download_", null ); try { Utils.copyStream( in, f ); } finally { Utils.closeQuietly( in ); } resolvedFile = new ResolvedFile( f, false ); } } catch( Exception e ) { throw new IOException( e ); } return resolvedFile; } }
DefaultUrlResolver implements IUrlResolver { @Override public ResolvedFile resolve( String url ) throws IOException { ResolvedFile resolvedFile; try { if( url.toLowerCase().startsWith( "file:/" )) { File f = new File( UriUtils.urlToUri( url )); resolvedFile = new ResolvedFile( f, true ); } else { URI uri = UriUtils.urlToUri( url ); InputStream in = uri.toURL().openStream(); File f = File.createTempFile( "rbcf_download_", null ); try { Utils.copyStream( in, f ); } finally { Utils.closeQuietly( in ); } resolvedFile = new ResolvedFile( f, false ); } } catch( Exception e ) { throw new IOException( e ); } return resolvedFile; }  }
DefaultUrlResolver implements IUrlResolver { @Override public ResolvedFile resolve( String url ) throws IOException { ResolvedFile resolvedFile; try { if( url.toLowerCase().startsWith( "file:/" )) { File f = new File( UriUtils.urlToUri( url )); resolvedFile = new ResolvedFile( f, true ); } else { URI uri = UriUtils.urlToUri( url ); InputStream in = uri.toURL().openStream(); File f = File.createTempFile( "rbcf_download_", null ); try { Utils.copyStream( in, f ); } finally { Utils.closeQuietly( in ); } resolvedFile = new ResolvedFile( f, false ); } } catch( Exception e ) { throw new IOException( e ); } return resolvedFile; }  @Override ResolvedFile resolve( String url ); }
DefaultUrlResolver implements IUrlResolver { @Override public ResolvedFile resolve( String url ) throws IOException { ResolvedFile resolvedFile; try { if( url.toLowerCase().startsWith( "file:/" )) { File f = new File( UriUtils.urlToUri( url )); resolvedFile = new ResolvedFile( f, true ); } else { URI uri = UriUtils.urlToUri( url ); InputStream in = uri.toURL().openStream(); File f = File.createTempFile( "rbcf_download_", null ); try { Utils.copyStream( in, f ); } finally { Utils.closeQuietly( in ); } resolvedFile = new ResolvedFile( f, false ); } } catch( Exception e ) { throw new IOException( e ); } return resolvedFile; }  @Override ResolvedFile resolve( String url );  }