@ Override public URLConnection openConnection ( URL url ) throws IOException { String path = url . getPath ( ) ; int resourceDelimiterIndex = path . indexOf ( "!/" ) ; URLConnection conn ; if ( resourceDelimiterIndex == - 1 ) { // The "jar" protocol requires that the path contain an entry path. // For backwards compatibility, we do not. Instead, we just // open a connection to the underlying URL. conn = Utils . newURL ( path ) . openConnection ( ) ; } else { // First strip the resource name out of the path String urlString = ParserUtils . decode ( path . substring ( 0 , resourceDelimiterIndex ) ) ; // Note that we strip off the leading "/" because ZipFile.getEntry does // not expect it to be present. String entry = ParserUtils . decode ( path . substring ( resourceDelimiterIndex + 2 ) ) ; // Since the URL we were passed may reference a file in a remote file system with // a UNC based name (\\Myhost\Mypath), we must take care to construct a new "host agnostic" // URL so that when we call getPath() on it we get the whole path, irregardless of whether // the resource is on a local or a remote file system. We will also now validate // our urlString has the proper "file" protocol prefix. URL jarURL = constructUNCTolerantURL ( "file" , urlString ) ; conn = new WSJarURLConnectionImpl ( url , jarURL . getPath ( ) , entry , zipCache ) ; } return conn ; }
begin 408408 . 2