-
Bug
-
Resolution: Fixed
-
P4
-
7u72, 8u25
-
b122
-
x86
-
windows_7
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8261802 | openjdk8u292 | Severin Gehwolf | P4 | Resolved | Fixed | b04 |
JDK-8258108 | 8u291 | Evan Whelan | P4 | Resolved | Fixed | b01 |
JDK-8262622 | emb-8u291 | Evan Whelan | P4 | Resolved | Fixed | team |
FULL PRODUCT VERSION :
1.7.0_72
1.8.0_25
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows Version 6.1.7601
EXTRA RELEVANT SYSTEM CONFIGURATION :
Windows System Locale : Japanese
A DESCRIPTION OF THE PROBLEM :
I'm writing a zip utility program with reference to Java SE 7 Documentation.
http://docs.oracle.com/javase/7/docs/technotes/guides/io/fsp/zipfilesystemprovider.html
IllegalArgumentException occurs when I try to convert some characters encoding into Shift_JIS.
Some characters are "\u8868" (0x955c in Shift_JIS), "\u7533 " (0x905c in Shift_JIS), "\u80fd" (0x945c in Shift_JIS) and so on. All the characters have "0x5c".
I have no problem without "0x5c" charcter.
----------
FileSystem zipfs = FileSystems.newFileSystem(uri, env);
zipfs.getPath(...);
Exception in thread "main" java.lang.IllegalArgumentException: MALFORMED[1]
at com.sun.nio.zipfs.ZipCoder.toString(ZipCoder.java:70)
----------
The encoding of the source code is Shift_JIS, and I compile with "-encoding Shift_JIS" option.
How may I convert this to Shift_JIS filename?
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.IllegalArgumentException: MALFORMED[1]
at com.sun.nio.zipfs.ZipCoder.toString(ZipCoder.java:70)
at com.sun.nio.zipfs.ZipCoder.toString(ZipCoder.java:78)
at com.sun.nio.zipfs.ZipFileSystem.getString(ZipFileSystem.java:916)
at com.sun.nio.zipfs.ZipFileSystem.deleteFile(ZipFileSystem.java:1342)
at com.sun.nio.zipfs.ZipPath.delete(ZipPath.java:655)
at com.sun.nio.zipfs.ZipFileSystemProvider.delete(ZipFileSystemProvider.java:206)
at java.nio.file.spi.FileSystemProvider.deleteIfExists(Unknown Source)
at java.nio.file.Files.deleteIfExists(Unknown Source)
at java.nio.file.CopyMoveHelper.copyToForeignTarget(Unknown Source)
at java.nio.file.Files.copy(Unknown Source)
at ZipFSPUser.main(ZipFSPUser.java:20)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class ZipFSPUser {
public static void main(String [] args) throws Throwable {
Map<String, String> env = new HashMap<>();
env.put("create", "true");
env.put("encoding", "Shift_JIS");
// locate file system by using the syntax
// defined in java.net.JarURLConnection
URI uri = URI.create("jar:file:/C:/codeSamples/zipfs/zipfstest.zip");
try (FileSystem zipfs = FileSystems.newFileSystem(uri, env)) {
Path externalTxtFile = Paths.get("C:\\表.txt");
System.out.println(externalTxtFile);
Path pathInZipfile = zipfs.getPath("/表.txt");
// copy a file into the zip file
Files.copy( externalTxtFile, pathInZipfile, StandardCopyOption.REPLACE_EXISTING );
}
}
}
---------- END SOURCE ----------
1.7.0_72
1.8.0_25
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows Version 6.1.7601
EXTRA RELEVANT SYSTEM CONFIGURATION :
Windows System Locale : Japanese
A DESCRIPTION OF THE PROBLEM :
I'm writing a zip utility program with reference to Java SE 7 Documentation.
http://docs.oracle.com/javase/7/docs/technotes/guides/io/fsp/zipfilesystemprovider.html
IllegalArgumentException occurs when I try to convert some characters encoding into Shift_JIS.
Some characters are "\u8868" (0x955c in Shift_JIS), "\u7533 " (0x905c in Shift_JIS), "\u80fd" (0x945c in Shift_JIS) and so on. All the characters have "0x5c".
I have no problem without "0x5c" charcter.
----------
FileSystem zipfs = FileSystems.newFileSystem(uri, env);
zipfs.getPath(...);
Exception in thread "main" java.lang.IllegalArgumentException: MALFORMED[1]
at com.sun.nio.zipfs.ZipCoder.toString(ZipCoder.java:70)
----------
The encoding of the source code is Shift_JIS, and I compile with "-encoding Shift_JIS" option.
How may I convert this to Shift_JIS filename?
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.IllegalArgumentException: MALFORMED[1]
at com.sun.nio.zipfs.ZipCoder.toString(ZipCoder.java:70)
at com.sun.nio.zipfs.ZipCoder.toString(ZipCoder.java:78)
at com.sun.nio.zipfs.ZipFileSystem.getString(ZipFileSystem.java:916)
at com.sun.nio.zipfs.ZipFileSystem.deleteFile(ZipFileSystem.java:1342)
at com.sun.nio.zipfs.ZipPath.delete(ZipPath.java:655)
at com.sun.nio.zipfs.ZipFileSystemProvider.delete(ZipFileSystemProvider.java:206)
at java.nio.file.spi.FileSystemProvider.deleteIfExists(Unknown Source)
at java.nio.file.Files.deleteIfExists(Unknown Source)
at java.nio.file.CopyMoveHelper.copyToForeignTarget(Unknown Source)
at java.nio.file.Files.copy(Unknown Source)
at ZipFSPUser.main(ZipFSPUser.java:20)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class ZipFSPUser {
public static void main(String [] args) throws Throwable {
Map<String, String> env = new HashMap<>();
env.put("create", "true");
env.put("encoding", "Shift_JIS");
// locate file system by using the syntax
// defined in java.net.JarURLConnection
URI uri = URI.create("jar:file:/C:/codeSamples/zipfs/zipfstest.zip");
try (FileSystem zipfs = FileSystems.newFileSystem(uri, env)) {
Path externalTxtFile = Paths.get("C:\\表.txt");
System.out.println(externalTxtFile);
Path pathInZipfile = zipfs.getPath("/表.txt");
// copy a file into the zip file
Files.copy( externalTxtFile, pathInZipfile, StandardCopyOption.REPLACE_EXISTING );
}
}
}
---------- END SOURCE ----------
- backported by
-
JDK-8258108 (zipfs) IllegalArgumentException in ZipCoder.toString when using Shitft_JIS
-
- Resolved
-
-
JDK-8261802 (zipfs) IllegalArgumentException in ZipCoder.toString when using Shitft_JIS
-
- Resolved
-
-
JDK-8262622 (zipfs) IllegalArgumentException in ZipCoder.toString when using Shitft_JIS
-
- Resolved
-
- duplicates
-
JDK-8255458 IllegalArgumentException in ZipCoder.toString when using MS932
-
- Resolved
-
- relates to
-
JDK-8158748 Speedup creation of nio.zipfs.ZipPath + performance regression from JDK-8061777
-
- Open
-