FULL PRODUCT VERSION :
Java 1.7
Java 1.8
ADDITIONAL OS VERSION INFORMATION :
Linux, probably any Unix-ish system
A DESCRIPTION OF THE PROBLEM :
Run the following with -Dfile.encoding=UTF-16:
public class TestBlah {
public static void main(String []) throws Exception {
TimeZone.getDefault();
}
}
This on linux (and any unixish system I think) will result in:
java.lang.ExceptionInInitializerError
at java.nio.file.FileSystems.getDefault(FileSystems.java:176)
at sun.util.calendar.ZoneInfoFile$1.run(ZoneInfoFile.java:482)
at sun.util.calendar.ZoneInfoFile$1.run(ZoneInfoFile.java:477)
...
There is an encoding-sensitive part calling getBytes on the initial path (and this screws it up):
// package-private
UnixFileSystem(UnixFileSystemProvider provider, String dir) {
this.provider = provider;
this.defaultDirectory = UnixPath.normalizeAndCheck(dir).getBytes();
if (this.defaultDirectory[0] != '/') {
throw new RuntimeException("default directory must be absolute");
}
REGRESSION. Last worked in version 6u31
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Reproduces every time w/ code above.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should be working with any multibyte encoding supported by the JVM
ACTUAL -
Fails with an exception.
java.lang.ExceptionInInitializerError
at java.nio.file.FileSystems.getDefault(FileSystems.java:176)
at sun.util.calendar.ZoneInfoFile$1.run(ZoneInfoFile.java:482)
at sun.util.calendar.ZoneInfoFile$1.run(ZoneInfoFile.java:477)
at java.security.AccessController.doPrivileged(Native Method)
at sun.util.calendar.ZoneInfoFile.<clinit>(ZoneInfoFile.java:476)
at sun.util.calendar.ZoneInfo.getTimeZone(ZoneInfo.java:658)
at java.util.TimeZone.getTimeZone(TimeZone.java:559)
at java.util.TimeZone.setDefaultZone(TimeZone.java:656)
at java.util.TimeZone.getDefaultRef(TimeZone.java:623)
at java.util.TimeZone.getDefault(TimeZone.java:610)
at org.apache.lucene.TestBlah.testDummy(TestBlah.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.RuntimeException: default directory must be absolute
at sun.nio.fs.UnixFileSystem.<init>(UnixFileSystem.java:54)
at sun.nio.fs.LinuxFileSystem.<init>(LinuxFileSystem.java:39)
at sun.nio.fs.LinuxFileSystemProvider.newFileSystem(LinuxFileSystemProvider.java:43)
at sun.nio.fs.LinuxFileSystemProvider.newFileSystem(LinuxFileSystemProvider.java:36)
at sun.nio.fs.UnixFileSystemProvider.<init>(UnixFileSystemProvider.java:55)
at sun.nio.fs.LinuxFileSystemProvider.<init>(LinuxFileSystemProvider.java:38)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at sun.nio.fs.DefaultFileSystemProvider$1.run(DefaultFileSystemProvider.java:52)
at sun.nio.fs.DefaultFileSystemProvider$1.run(DefaultFileSystemProvider.java:43)
at java.security.AccessController.doPrivileged(Native Method)
at sun.nio.fs.DefaultFileSystemProvider.createProvider(DefaultFileSystemProvider.java:42)
at sun.nio.fs.DefaultFileSystemProvider.create(DefaultFileSystemProvider.java:70)
at java.nio.file.FileSystems$DefaultFileSystemHolder.getDefaultProvider(FileSystems.java:108)
at java.nio.file.FileSystems$DefaultFileSystemHolder.access$000(FileSystems.java:89)
at java.nio.file.FileSystems$DefaultFileSystemHolder$1.run(FileSystems.java:98)
at java.nio.file.FileSystems$DefaultFileSystemHolder$1.run(FileSystems.java:96)
at java.security.AccessController.doPrivileged(Native Method)
at java.nio.file.FileSystems$DefaultFileSystemHolder.defaultFileSystem(FileSystems.java:95)
at java.nio.file.FileSystems$DefaultFileSystemHolder.<clinit>(FileSystems.java:90)
... 34 more
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
# Run with -Dfile.encoding=UTF-16
public class TestBlah {
public static void main(String []) throws Exception {
TimeZone.getDefault();
}
}
---------- END SOURCE ----------
Java 1.7
Java 1.8
ADDITIONAL OS VERSION INFORMATION :
Linux, probably any Unix-ish system
A DESCRIPTION OF THE PROBLEM :
Run the following with -Dfile.encoding=UTF-16:
public class TestBlah {
public static void main(String []) throws Exception {
TimeZone.getDefault();
}
}
This on linux (and any unixish system I think) will result in:
java.lang.ExceptionInInitializerError
at java.nio.file.FileSystems.getDefault(FileSystems.java:176)
at sun.util.calendar.ZoneInfoFile$1.run(ZoneInfoFile.java:482)
at sun.util.calendar.ZoneInfoFile$1.run(ZoneInfoFile.java:477)
...
There is an encoding-sensitive part calling getBytes on the initial path (and this screws it up):
// package-private
UnixFileSystem(UnixFileSystemProvider provider, String dir) {
this.provider = provider;
this.defaultDirectory = UnixPath.normalizeAndCheck(dir).getBytes();
if (this.defaultDirectory[0] != '/') {
throw new RuntimeException("default directory must be absolute");
}
REGRESSION. Last worked in version 6u31
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Reproduces every time w/ code above.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should be working with any multibyte encoding supported by the JVM
ACTUAL -
Fails with an exception.
java.lang.ExceptionInInitializerError
at java.nio.file.FileSystems.getDefault(FileSystems.java:176)
at sun.util.calendar.ZoneInfoFile$1.run(ZoneInfoFile.java:482)
at sun.util.calendar.ZoneInfoFile$1.run(ZoneInfoFile.java:477)
at java.security.AccessController.doPrivileged(Native Method)
at sun.util.calendar.ZoneInfoFile.<clinit>(ZoneInfoFile.java:476)
at sun.util.calendar.ZoneInfo.getTimeZone(ZoneInfo.java:658)
at java.util.TimeZone.getTimeZone(TimeZone.java:559)
at java.util.TimeZone.setDefaultZone(TimeZone.java:656)
at java.util.TimeZone.getDefaultRef(TimeZone.java:623)
at java.util.TimeZone.getDefault(TimeZone.java:610)
at org.apache.lucene.TestBlah.testDummy(TestBlah.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.RuntimeException: default directory must be absolute
at sun.nio.fs.UnixFileSystem.<init>(UnixFileSystem.java:54)
at sun.nio.fs.LinuxFileSystem.<init>(LinuxFileSystem.java:39)
at sun.nio.fs.LinuxFileSystemProvider.newFileSystem(LinuxFileSystemProvider.java:43)
at sun.nio.fs.LinuxFileSystemProvider.newFileSystem(LinuxFileSystemProvider.java:36)
at sun.nio.fs.UnixFileSystemProvider.<init>(UnixFileSystemProvider.java:55)
at sun.nio.fs.LinuxFileSystemProvider.<init>(LinuxFileSystemProvider.java:38)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at sun.nio.fs.DefaultFileSystemProvider$1.run(DefaultFileSystemProvider.java:52)
at sun.nio.fs.DefaultFileSystemProvider$1.run(DefaultFileSystemProvider.java:43)
at java.security.AccessController.doPrivileged(Native Method)
at sun.nio.fs.DefaultFileSystemProvider.createProvider(DefaultFileSystemProvider.java:42)
at sun.nio.fs.DefaultFileSystemProvider.create(DefaultFileSystemProvider.java:70)
at java.nio.file.FileSystems$DefaultFileSystemHolder.getDefaultProvider(FileSystems.java:108)
at java.nio.file.FileSystems$DefaultFileSystemHolder.access$000(FileSystems.java:89)
at java.nio.file.FileSystems$DefaultFileSystemHolder$1.run(FileSystems.java:98)
at java.nio.file.FileSystems$DefaultFileSystemHolder$1.run(FileSystems.java:96)
at java.security.AccessController.doPrivileged(Native Method)
at java.nio.file.FileSystems$DefaultFileSystemHolder.defaultFileSystem(FileSystems.java:95)
at java.nio.file.FileSystems$DefaultFileSystemHolder.<clinit>(FileSystems.java:90)
... 34 more
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
# Run with -Dfile.encoding=UTF-16
public class TestBlah {
public static void main(String []) throws Exception {
TimeZone.getDefault();
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-7050570 (fs) FileSystemProvider fails to initializes if run with file.encoding set to Cp037
- Closed