< prev index next >

src/java.base/unix/classes/jdk/internal/loader/FileURLMapper.java

Print this page
imported patch classloader-cleanup

*** 28,62 **** import java.net.URL; import java.io.File; import sun.net.www.ParseUtil; /** ! * (Solaris) platform specific handling for file: URLs . ! * urls must not contain a hostname in the authority field * other than "localhost". * * This implementation could be updated to map such URLs ! * on to /net/host/... * * @author Michael McMahon */ public class FileURLMapper { ! ! URL url; String path; ! public FileURLMapper (URL url) { this.url = url; } /** * @return the platform specific path corresponding to the URL * so long as the URL does not contain a hostname in the authority field. */ ! ! public String getPath () { if (path != null) { return path; } String host = url.getHost(); if (host == null || host.isEmpty() || "localhost".equalsIgnoreCase(host)) { --- 28,60 ---- import java.net.URL; import java.io.File; import sun.net.www.ParseUtil; /** ! * (Unix) platform specific handling for file: URLs . ! * URLs must not contain a hostname in the authority field * other than "localhost". * * This implementation could be updated to map such URLs ! * on to /net/host/... on system using such an automounter map. * * @author Michael McMahon */ public class FileURLMapper { ! final URL url; String path; ! public FileURLMapper(URL url) { this.url = url; } /** * @return the platform specific path corresponding to the URL * so long as the URL does not contain a hostname in the authority field. */ ! public String getPath() { if (path != null) { return path; } String host = url.getHost(); if (host == null || host.isEmpty() || "localhost".equalsIgnoreCase(host)) {
*** 67,81 **** } /** * Checks whether the file identified by the URL exists. */ ! public boolean exists () { ! String s = getPath (); ! if (s == null) { ! return false; ! } else { ! File f = new File (s); ! return f.exists(); ! } } } --- 65,74 ---- } /** * Checks whether the file identified by the URL exists. */ ! public boolean exists() { ! String s = getPath(); ! return s != null && new File(s).exists(); } }
< prev index next >