Details
Description
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
Attachments
Issue Links
- is related to
-
SPR-11887 Spring 3.2.9 breaks JBoss EAP 5.1.1 VFS compatibility
-
- Closed
-