FileSystemProvider

Michael Hall mik3hall at gmail.com
Thu Apr 29 00:13:35 UTC 2021


Possibly related to https://bugs.openjdk.java.net/browse/JDK-8263940 <https://bugs.openjdk.java.net/browse/JDK-8263940>

I have recreated this with the JDK-16. I think it begins after JDK-12. I don’t have.a 13 it is present in 14.

javac -d . ~/Documents/GitHub/jdk16-master/test/jdk/java/nio/file/spi/TestProvider.java

Your test case. Not properly set up on git for me, but there.

The error is if -Djava.security.manager and -Djava.security.policy are used in invocation….

 /usr/libexec/java_home -v 14 --exec java -cp . -Djava.security.manager -Djava.security.policy=Classes/all.policy -Djava.nio.file.spi.DefaultFileSystemProvider=TestProvider Test
Exception in thread "main” java.lang.StackOverflowError
	at java.base/java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:228)
	at java.base/java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:593)
	at java.base/java.lang.StringBuilder.append(StringBuilder.java:173)
	at java.base/java.security.Security.getProperty(Security.java:765)
	at java.base/sun.security.provider.PolicyFile$1.run(PolicyFile.java:310)
	at java.base/sun.security.provider.PolicyFile$1.run(PolicyFile.java:306)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
	at java.base/sun.security.provider.PolicyFile.init(PolicyFile.java:306)
	at java.base/sun.security.provider.PolicyFile.<init>(PolicyFile.java:283)
	at java.base/java.security.Policy.loadPolicyProvider(Policy.java:207)
	at java.base/java.security.Policy.getPolicyNoCheck(Policy.java:178)
	at java.base/java.security.ProtectionDomain.implies(ProtectionDomain.java:321)
	at java.base/java.security.ProtectionDomain.impliesWithAltFilePerm(ProtectionDomain.java:353)
	at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:450)
	at java.base/java.security.AccessController.checkPermission(AccessController.java:1036)
	at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:408)
	at java.base/java.lang.SecurityManager.checkRead(SecurityManager.java:747)
	at java.base/sun.nio.fs.UnixChannelFactory.open(UnixChannelFactory.java:255)
	at java.base/sun.nio.fs.UnixChannelFactory.newFileChannel(UnixChannelFactory.java:143)
	at java.base/sun.nio.fs.UnixChannelFactory.newFileChannel(UnixChannelFactory.java:156)
	at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:217)
	at TestProvider.newByteChannel(TestProvider.java:173)
	at java.base/java.nio.file.Files.newByteChannel(Files.java:375)
	at java.base/java.nio.file.Files.newByteChannel(Files.java:426)
	at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:420)
	at java.base/java.nio.file.Files.newInputStream(Files.java:160)
	at java.base/java.nio.file.Files.newBufferedReader(Files.java:2916)
	at java.base/java.nio.file.Files.newBufferedReader(Files.java:2948)
	at java.base/sun.security.provider.PolicyFile.initDefaultPolicy(PolicyFile.java:485)
	at java.base/sun.security.provider.PolicyFile$2.run(PolicyFile.java:340)
	at java.base/sun.security.provider.PolicyFile$2.run(PolicyFile.java:337)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
	at java.base/sun.security.provider.PolicyFile.initPolicyFile(PolicyFile.java:337)
	at java.base/sun.security.provider.PolicyFile.init(PolicyFile.java:330)
	at java.base/sun.security.provider.PolicyFile.<init>(PolicyFile.java:283)
	at java.base/java.security.Policy.loadPolicyProvider(Policy.java:207)
	at java.base/java.security.Policy.getPolicyNoCheck(Policy.java:178)
	at java.base/java.security.ProtectionDomain.implies(ProtectionDomain.java:321)
	at java.base/java.security.ProtectionDomain.impliesWithAltFilePerm(ProtectionDomain.java:353)
	at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:450)
	at java.base/java.security.AccessController.checkPermission(AccessController.java:1036)
	at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:408)
	at java.base/java.lang.SecurityManager.checkRead(SecurityManager.java:747)
	at java.base/sun.nio.fs.UnixChannelFactory.open(UnixChannelFactory.java:255)
	at java.base/sun.nio.fs.UnixChannelFactory.newFileChannel(UnixChannelFactory.java:143)
	at java.base/sun.nio.fs.UnixChannelFactory.newFileChannel(UnixChannelFactory.java:156)
	at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:217)
	at TestProvider.newByteChannel(TestProvider.java:173)

It loops until the StackOverflowError.
If not related should I do a bug report?



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20210428/08f6ca89/attachment-0001.htm>


More information about the nio-dev mailing list