Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UrlResource.exists() does not properly detect JBoss vfszip resources [SPR-11676] #16299

spring-projects-issues opened this issue Apr 8, 2014 · 4 comments
in: core status: backported type: bug


Copy link

@spring-projects-issues spring-projects-issues commented Apr 8, 2014

Kamil Podlešák opened SPR-11676 and commented

Method treats jboss vfs URLs (protocol starting with "vfs") as files: it calls getFile().exists(). There is no fallback.

Unfortunately, vfszip:// resources (files inside JAR files) do not support getFile() and throw exception (see the "is nested" if command).

One obvious fix would be to provide fallback (that is, if getFile() throws an exception, it continues by handling the URL).
At this moment, the only solution is to not use exists(), but this workaround code instead:

Resource res = ldr.getResource(locator);
boolean exists = false;
try {
    // Jboss vfzip:// does not support  exists() method
    // so we'll just try opening it and handle exception
    exists = true;
} catch (IOException e) {, "cannot open meta.xml", e);
if (!exists) {

Apparently, this is probably also root cause of SEC-1700

Affects: 3.2.8, 4.0.3

Issue Links:

  • #16506 Spring 3.2.9 breaks JBoss EAP 5.1.1 VFS compatibility

Backported to: 3.2.9

Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Apr 9, 2014

Juergen Hoeller commented

Fixed at the ResourceUtils.isFileURL/isJarURL level now: "vfs" needs to be treated as file URL, whereas "vfszip" needs to be treated as jar URL (never trying getFile resolution in AbstractFileResolvingResource, always using the alternative stream-based code path instead).


Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented May 12, 2014

Juergen Hoeller commented

Kamil, does this work for you now, against 4.0.4 and/or the latest 3.2.9 snapshot?


Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented May 13, 2014

Kamil Podlešák commented

Yes, I've just made special build with 2.6.9 snapshot and it works correctly now.
Thanks for the fix, Kamil.

Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 19, 2014

Patrick Decat commented

We did not have this issue with JBoss EAP 5.1.
This change provoked #16506.

@spring-projects-issues spring-projects-issues added type: bug status: backported in: core labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.0.4 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: core status: backported type: bug
None yet

No branches or pull requests

2 participants