public URL getURL() throws IOException { if (resource != null) { return resource; } else { String absolutePath = path.getAbsolutePath(); try { return new URI("file", absolutePath, null).toURL(); } catch(URISyntaxException e) { try { // Let's try this one more time. For some reason [ and ] // are not getting escaped in URI (I think they are for // ipv6 host stuff). We make this double attempt so that // we are not constantly trying to string substitute every // path we encounter. return new URI("file", escapeReservedChars(absolutePath), null).toURL(); } catch (URISyntaxException ee) { throw new IOException(ee.getMessage()); } } } }
public URL getURL() throws IOException { if (resource != null) { return resource; } else { String absolutePath = path.getAbsolutePath(); try { return new URI("file", absolutePath, null).toURL(); } catch(URISyntaxException e) { try { // Let's try this one more time. For some reason [ and ] // are not getting escaped in URI (I think they are for // ipv6 host stuff). We make this double attempt so that // we are not constantly trying to string substitute every // path we encounter. return new URI("file", escapeReservedChars(absolutePath), null).toURL(); } catch (URISyntaxException ee) { throw new IOException(ee.getMessage()); } } } }
public URL getURL() throws IOException { if (resource != null) { return resource; } else { String absolutePath = path.getAbsolutePath(); try { return new URI("file", absolutePath, null).toURL(); } catch(URISyntaxException e) { try { // Let's try this one more time. For some reason [ and ] // are not getting escaped in URI (I think they are for // ipv6 host stuff). We make this double attempt so that // we are not constantly trying to string substitute every // path we encounter. return new URI("file", escapeReservedChars(absolutePath), null).toURL(); } catch (URISyntaxException ee) { throw new IOException(ee.getMessage()); } } } }
public URL getURL() throws IOException { if (resource != null) { return resource; } else { String absolutePath = path.getAbsolutePath(); try { return new URI("file", absolutePath, null).toURL(); } catch(URISyntaxException e) { try { // Let's try this one more time. For some reason [ and ] // are not getting escaped in URI (I think they are for // ipv6 host stuff). We make this double attempt so that // we are not constantly trying to string substitute every // path we encounter. return new URI("file", escapeReservedChars(absolutePath), null).toURL(); } catch (URISyntaxException ee) { throw new IOException(ee.getMessage()); } } } }