JDK-8282425 : ZipPath getFileAttributeView doesn't comply with spec
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 17
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2021-05-26
  • Updated: 2022-03-03
  • Resolved: 2022-02-27
Related Reports
Duplicate :  
Duplicate :  
Description
A DESCRIPTION OF THE PROBLEM :
ZipPath.java:716 (as of 9d305b9c0625d73c752724569dbb7f6c8e80931c) throws UnsupportedOperationException if getFileAttributeView is called on a ZipPath for an unrecognized or disabled attribute view. However the JavaDocs say File.getFileAttributeView should return null when a view is unsupported.

This means you can't check for a ZipFS that has POSIX attributes enabled by simply querying the view without also being prepared to catch this exception, which is unexpected.


CUSTOMER SUBMITTED WORKAROUND :
Catch the exception and convert it to null.


Comments
The response from the submitter: That's indeed a duplicate and the fix looks fine, thanks for locating it. The relevant code no longer exists so it'd be some effort to test but I'm sure the fix will work.
03-03-2022

Suggested the submitter try the latest version of JDK 18 from https://jdk.java.net/18/
24-02-2022

This issue looks like a duplicate of JDK-8274607
24-02-2022

Requested a simple reproducer from the submitter.
24-02-2022