Bug in resource handling for JBoss 5.0.0 vfszip protocol on Windows
-------------------------------------------------------------------
Key: TOBAGO-964
URL: https://issues.apache.org/jira/browse/TOBAGO-964
Project: MyFaces Tobago
Issue Type: Bug
Components: Core
Affects Versions: 1.0.33
Environment: Windows
Reporter: Helmut Swaczinna
Priority: Minor
Separator chars are not handled correct under windows.
Fix:
private void addResources(ResourceManagerImpl resources, URL themeUrl, String
prefix, int skipPrefix)
throws IOException, ServletException {
String fileName = themeUrl.toString();
int index = fileName.indexOf("!");
String protocol = themeUrl.getProtocol();
if (index != -1) {
fileName = fileName.substring(protocol.length() + 1, index);
}
if (LOG.isInfoEnabled()) {
LOG.info("Adding resources from fileName='"+fileName + "' prefix='" +
prefix + "' skip=" + skipPrefix + "");
}
// JBoss 5.0.0 introduced vfszip protocol
if (!protocol.equals("vfszip") &&
fileName.endsWith(META_INF_TOBAGO_THEME_XML)) {
try {
URI uri = themeUrl.toURI();
File tobagoThemeXml = new File(uri);
File directoryFile = tobagoThemeXml.getParentFile().getParentFile();
String resourcePath = "";
resolveTheme(resources, directoryFile, resourcePath, prefix, false);
} catch (URISyntaxException e) {
LOG.error("", e);
}
} else {
URL jarFile;
try {
// JBoss 5.0.0 introduced vfszip protocol
if (protocol.equals("vfszip")) {
fileName = new
File(fileName).getParentFile().getParentFile().getPath();
if (File.separatorChar == '\\' && fileName.contains("\\")) {
fileName = fileName.replace('\\', '/');
LOG.info("Fixed slashes for virtual filesystem protocoll on windows
system: " + fileName);
}
}
jarFile = new URL(fileName);
} catch (MalformedURLException e) {
// workaround for weblogic on windows
jarFile = new URL("file:" + fileName);
}
InputStream stream = null;
ZipInputStream zipStream = null;
try {
stream = jarFile.openStream();
zipStream = new ZipInputStream(stream);
while (zipStream.available() > 0) {
ZipEntry nextEntry = zipStream.getNextEntry();
if (nextEntry == null || nextEntry.isDirectory()) {
continue;
}
String name = "/" + nextEntry.getName();
if (name.startsWith(prefix)) {
addResource(resources, name, skipPrefix);
}
}
} finally {
IOUtils.closeQuietly(stream);
IOUtils.closeQuietly(zipStream);
}
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.