You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Helmut Swaczinna (JIRA)" <de...@myfaces.apache.org> on 2011/01/06 11:01:46 UTC
[jira] Created: (TOBAGO-964) Bug in resource handling for JBoss
5.0.0 vfszip protocol on Windows
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.
[jira] Updated: (TOBAGO-964) Bug in resource handling for JBoss
5.0.0 vfszip protocol on Windows
Posted by "Helmut Swaczinna (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TOBAGO-964?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Helmut Swaczinna updated TOBAGO-964:
------------------------------------
Status: Patch Available (was: Open)
> 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.
[jira] Resolved: (TOBAGO-964) Bug in resource handling for JBoss
5.0.0 vfszip protocol on Windows
Posted by "Bernd Bohmann (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TOBAGO-964?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bernd Bohmann resolved TOBAGO-964.
----------------------------------
Resolution: Fixed
> 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.32
> Environment: Windows
> Reporter: Helmut Swaczinna
> Assignee: Bernd Bohmann
> Priority: Minor
> Fix For: 1.5.0-alpha-2, 1.0.33
>
>
> 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.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira