JDK-7181452 : Addendum: Bug#7181278
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86
  • Submitted: 2012-07-03
  • Updated: 2012-08-03
  • Resolved: 2012-07-11
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :


A DESCRIPTION OF THE PROBLEM :
I can find no way to post to or edit bug#7181278 that I recently posted, so I'm trying a new report that references that one. Please update bug#7181278, delete this addendum, and let me know of a more proper way to update a bug report.

I accidentally copied and pasted a truncated version of the revised uniToPath(uri) method to the original bug report. It was missing the check for the "jar" scheme. Please replace it with the following correct full version.


REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
static Path uriToPath(URI uri) {
    String scheme = uri.getScheme();
    if (scheme == null || !scheme.equalsIgnoreCase(getScheme())) {
        throw new IllegalArgumentException("URI scheme is not '" + getScheme() + "'");
    }
    try {
        // only support legacy JAR URL syntax  jar:{uri}!/{entry} for now
        String spec = uri.getRawSchemeSpecificPart();
        int sep = spec.indexOf("!/");
        if (sep != -1) spec = spec.substring(0, sep);
        return Paths.get(new URI(spec)).toAbsolutePath();
    } catch (URISyntaxException exception) {
        throw new IllegalArgumentException(exception.getMessage(), exception);
    }
}