protected static URL constructUNCTolerantURL(String protocolPrefix, String urlString) throws IOException {
        int protocolDelimiterIndex = urlString.indexOf(':');
        String urlProtocol, urlPath;
        if (protocolDelimiterIndex < 0 || !(urlProtocol = urlString.substring(0, protocolDelimiterIndex)).equalsIgnoreCase(protocolPrefix)) {
            throw new IOException("invalid protocol prefix: the passed urlString: " + urlString + " is not of the specified protocol: " + protocolPrefix);
        }
        urlPath = urlString.substring(protocolDelimiterIndex + 1);

        // By using this constructor we make sure the JDK does not attempt to interpret leading characters
        // as a host name. This assures that any embedded UNC encoded string prefixes are ignored and
        // subsequent calls to getPath on this URL will always return the full path string (including the 
        // UNC host prefix).
        URL jarURL = Utils.newURL(urlProtocol, "", -1, urlPath);
        return jarURL;
    }
protected static URL constructUNCTolerantURL ( String protocolPrefix , String urlString ) throws IOException { int protocolDelimiterIndex = urlString . indexOf ( ':' ) ; String urlProtocol , urlPath ; if ( protocolDelimiterIndex < 0 || ! ( urlProtocol = urlString . substring ( 0 , protocolDelimiterIndex ) ) . equalsIgnoreCase ( protocolPrefix ) ) { throw new IOException ( "invalid protocol prefix: the passed urlString: " + urlString + " is not of the specified protocol: " + protocolPrefix ) ; } urlPath = urlString . substring ( protocolDelimiterIndex + 1 ) ; URL jarURL = Utils . newURL ( urlProtocol , "" , - 1 , urlPath ) ; return jarURL ; }
<liberty> brought across from ClassLoaderUtils from /SERV1/ws/code/classloader/src/com/ibm/ws/classloader/</liberty>
A method for constructing a purely path based URL from an input string that may
optionally contain UNC compliant host names. Examples of properly formatted urlString inputs
are as follows:

Remote file system (UNC convention)
protocolPrefix://host/path
protocolPrefix:////host/path

Local file system
protocolPrefix:/path
protocolPrefix:/C:/path

The input urlString is validated such that it must begin with the protocolPrefix.

Note: UNC paths are used by several OS platforms to map remote file systems. Using this
method guarantees that even if the pathComponent contains a UNC based host, the host
prefix of the path will be treated as path information and not interpreted as a host
component part of the URL returned by this method.

@param protocolPrefix The String which is used verify the presence of the urlString protocol before it is removed.
@param urlString A string which will be processed, parsed and used to construct a Hostless URL.
@return A URL that is constructed consisting of only path information (no implicit host information).
@throws IOException is Thrown if the input urlString does not begin with the specified protocolPrefix.