< prev index next >

src/java.base/share/classes/jdk/internal/jrtfs/JrtPath.java

Print this page
rev 55068 : 8224908: Revert: 8216553: JrtFileSystemProvider getPath(URI) omits /modules element from file path
Reviewed-by:

*** 23,33 **** * questions. */ package jdk.internal.jrtfs; import java.io.File; - import java.io.IOError; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.URI; import java.net.URISyntaxException; --- 23,32 ----
*** 169,188 **** } @Override public final URI toUri() { try { ! String p = toAbsolutePath().path; ! if (!p.startsWith("/modules") || p.contains("..")) { ! throw new IOError(new RuntimeException(p + " cannot be represented as URI")); ! } ! ! p = p.substring("/modules".length()); ! if (p.isEmpty()) { ! p = "/"; ! } ! return new URI("jrt", p, null); } catch (URISyntaxException ex) { throw new AssertionError(ex); } } --- 168,178 ---- } @Override public final URI toUri() { try { ! return new URI("jrt", toAbsolutePath().path, null); } catch (URISyntaxException ex) { throw new AssertionError(ex); } }
< prev index next >