-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Closed
Copy link
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: bugA general bugA general bug
Milestone
Description
Kamil Podlešák opened SPR-11676 and commented
Method org.springframework.core.io.AbstractFileResolvingResource#exists 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 org.springframework.core.io.VfsUtils#getFile 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 {
//!!HACK!!
// Jboss vfzip:// does not support exists() method
// so we'll just try opening it and handle exception
res.getInputStream().close();
exists = true;
} catch (IOException e) {
log.info(this, "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:
- Spring 3.2.9 breaks JBoss EAP 5.1.1 VFS compatibility [SPR-11887] #16506 Spring 3.2.9 breaks JBoss EAP 5.1.1 VFS compatibility
Backported to: 3.2.9
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: bugA general bugA general bug