On Thu, 18 Jun 2026 18:07:04 GMT, Chen Liang <[email protected]> wrote:

>> src/java.base/share/classes/jdk/internal/jrtfs/ExplodedImage.java line 324:
>> 
>>> 322:             node = new PathNode(name, selected, attrs);
>>> 323:         } else if (attrs.isDirectory()) {
>>> 324:             List<Path> directories = Stream.of(regularPath, 
>>> previewPath)
>> 
>> Should we handle file-vs-directory conflicts like the following here?
>> 
>> 
>> modules/m/foo/                         // regular directory
>> modules/m/META-INF/preview/foo         // preview regular file
>> 
>> 
>> or the reverse case:
>> 
>> 
>> modules/m/foo                          // regular file
>> modules/m/META-INF/preview/foo/        // preview directory
>> 
>> 
>> For example, should we reject these as an invalid layout during node 
>> creation, instead of letting `Files.newDirectoryStream(absPath)` throw later 
>> from `collectChildNodeNames()`?
>> 
>> I would expect us to detect and handle this earlier.
>> 
>> Not a blocker, though.
>
> Do you recall how ImageReader is handling this situation right now? Does it 
> ignore such inconsistencies or throw eagerly or fail latently like 
> ExplodedImage?
> 
> I'm hesitant to change ExplodedImage when we can't ensure parity with 
> ImageReader.

> I would expect us to detect and handle this earlier.

The only files in META-INF/preview will be the class files for the wrapper 
classes, optional and java.time. There aren't any non-class resources. A bug in 
the JDK build or something making changes outside of build could create these 
weird scenario but I don't think we should worry about that now. We can do 
improvements on this once the code is in main line.

-------------

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2545#discussion_r3437966243

Reply via email to