jdk7 ZipFileSystemProvider and URI Encoding

Jan Schlößin jan.schloessin at incasoft.de
Tue Oct 16 03:11:07 PDT 2012


Am 15.10.2012 13:10, schrieb Alan Bateman:

[...]

> Have you verified that it is fixed in jdk8? (just checking to make sure
> that you are running into the same issue as was fixed).
> 
> -Alan

Hello Alan,

this is my test case for accessing a zip file with a space in the path.

  @Test
  public void testCreationOfZipFromURIWithSpace() throws IOException,
URISyntaxException {
    Map<String, String> env = Collections.emptyMap();
    Path fileWithSpaceName = Paths.get(" ");
    FileSystems.newFileSystem(new URI("jar:"
    + fileWithSpaceName.toUri()), env);
  }

i get the expected java.nio.file.FileSystemNotFoundException in jdk8 but
an IllegalArgumentException in jdk7

The diff between 7u6-b24 and jdk8-b60 in ZipFileSystemProvider.java is:

81c81
<             String spec = uri.getSchemeSpecificPart();
---
>             String spec = uri.getRawSchemeSpecificPart();
214c214
<         return (V)ZipFileAttributeView.get(toZipPath(path), type);
---
>         return ZipFileAttributeView.get(toZipPath(path), type);

Can you backport the changes to jdk7?

Thanks,
Jan


More information about the nio-dev mailing list