@Test(expected = ConstrettoException.class) public void testOpenMalformedUrlResource() throws Exception { final UrlResource urlResource = new UrlResource("++malformed:url:resource"); urlResource.getInputStream(); }
@Override public InputStream getInputStream() { try { URL url = new URL(path); return url.openStream(); } catch (MalformedURLException ex) { throw new ConstrettoException("Could not load URL. Path tried: [" + path + "]", ex); } catch (IOException e) { throw new ConstrettoException("Woot", e); } }
UrlResource extends Resource { @Override public InputStream getInputStream() { try { URL url = new URL(path); return url.openStream(); } catch (MalformedURLException ex) { throw new ConstrettoException("Could not load URL. Path tried: [" + path + "]", ex); } catch (IOException e) { throw new ConstrettoException("Woot", e); } } }
UrlResource extends Resource { @Override public InputStream getInputStream() { try { URL url = new URL(path); return url.openStream(); } catch (MalformedURLException ex) { throw new ConstrettoException("Could not load URL. Path tried: [" + path + "]", ex); } catch (IOException e) { throw new ConstrettoException("Woot", e); } } UrlResource(String path); }
UrlResource extends Resource { @Override public InputStream getInputStream() { try { URL url = new URL(path); return url.openStream(); } catch (MalformedURLException ex) { throw new ConstrettoException("Could not load URL. Path tried: [" + path + "]", ex); } catch (IOException e) { throw new ConstrettoException("Woot", e); } } UrlResource(String path); @Override boolean exists(); @Override InputStream getInputStream(); }
UrlResource extends Resource { @Override public InputStream getInputStream() { try { URL url = new URL(path); return url.openStream(); } catch (MalformedURLException ex) { throw new ConstrettoException("Could not load URL. Path tried: [" + path + "]", ex); } catch (IOException e) { throw new ConstrettoException("Woot", e); } } UrlResource(String path); @Override boolean exists(); @Override InputStream getInputStream();  }