Details
-
Bug
-
Resolution: Fixed
-
P4
-
17, 18
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8274607 | 17.0.2 | Severin Gehwolf | P4 | Resolved | Fixed | b01 |
JDK-8285582 | 15.0.8 | Yuri Nesterenko | P4 | Resolved | Fixed | b02 |
Description
https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/nio/file/Files.html#getFileAttributeView(java.nio.file.Path,java.lang.Class,java.nio.file.LinkOption...)
"""
Returns:
a file attribute view of the specified type, or null if the attribute view type is not available
"""
Yet, an exception is thrown in some cases. That is a regression to JDK 11. See the attached reproducer.
JDK 11 run:
--------------------------
Debug: Creating test-zip-file.zip...
Debug: reading entry: /noperm_entry
Debug: os.name == Linux
Non-Windows Test PASSED! env=posix view=null, featureVersion: 11
Debug: reading entry: /noperm_entry
Debug: os.name == Linux
Non-Windows Test PASSED! env=empty view=null, featureVersion: 11
JDK 17+ runs:
--------------------------
Debug: Creating test-zip-file.zip...
Debug: reading entry: /noperm_entry
Debug: os.name == Linux
Non-Windows Test PASSED! env=posix view=jdk.nio.zipfs.ZipPosixFileAttributeView@2f2c9b19, featureVersion: 17
Debug: reading entry: /noperm_entry
Debug: Files.getFileAttributeView() threw exception: java.lang.UnsupportedOperationException: view <interface java.nio.file.attribute.PosixFileAttributeView> is not supported
Debug: os.name == Linux
Exception in thread "main" java.lang.RuntimeException: Test failed! view=null
at TestPosixAttributeView.runTest(TestPosixAttributeView.java:83)
at TestPosixAttributeView.main(TestPosixAttributeView.java:105)
This was originally reported here, where the issue is that on Windows, where Posix permissions are not supported, suddenly throws an exception when it didn't before
https://github.com/adoptium/adoptium-support/issues/363
Attachments
Issue Links
- backported by
-
JDK-8274607 (zipfs) Files.getFileAttributeView() throws UOE instead of returning null when view not supported
- Resolved
-
JDK-8285582 (zipfs) Files.getFileAttributeView() throws UOE instead of returning null when view not supported
- Resolved
- duplicates
-
JDK-8282425 ZipPath getFileAttributeView doesn't comply with spec
- Closed
- relates to
-
JDK-8213031 (zipfs) Add support for POSIX file permissions
- Resolved
- links to
-
Commit openjdk/jdk15u-dev/1d29a2ff
-
Commit openjdk/jdk17u/de6899b6
-
Commit openjdk/jdk/161fdb4a
-
Review openjdk/jdk15u-dev/199
-
Review openjdk/jdk17u/109
-
Review openjdk/jdk/5579