Skip to content

AbstractFileResolvingResource.exists closes JAR resource input streams with v6.2.7 #34955

Open
@marcrohlfs

Description

@marcrohlfs

Calling org.springframework.core.io.Resource#exists is called on a resource inside a JAR file (actually org.springframework.core.io.AbstractFileResolvingResource#exists in such cases), an input stream of whether the same or another resource in the same JAR file is (accidentally) closed. Trying to read (or continue reading) from such an input stream afterwards results in an java.io.IOException: Stream closed. The exist method should just answer it's intended question, but it should never change the state of an input stream.

This issue was introduced with v6.2.7, apparently with the fix for #34796.

I've created a small test project that shows some different combinations of resource reading along with exists checks: jar-resource-loader-test.zip

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions