And here comes the attachment ... :)

Stefan Hedtfeld schrieb:
Hi,

I'm using tobago-1.1.0-SNAPSHOT on JBoss 5.0.0.CR1. Deploying my application failed due to an exception in ResourceLocator because JBoss introduced a new protocol vfszip: for accessing archives. It gives a warning "Unknown protocol 'vfszip:/home/stefan/as/jboss-5.0.0.CR1/server/devel/deploy/myapp.ear/tobago-theme-speyside-1.1.0-SNAPSHOT.jar/META-INF/tobago-theme.xml'" and then fails when creating a File instance without the file: protocol.

I tried several ways to access the file correctly, the only way seems to be to handle this like an archive but going up to directories. I've attached a diff to give you an impression - I'm not sure if it is the correct approach to handle this in tobago as I would think if JBoss introduces a new protocol then this should not impact tobago.

Any thoughts about this?

Regards,

Stefan.


Index: ResourceLocator.java
===================================================================
--- ResourceLocator.java	(Revision 674655)
+++ ResourceLocator.java	(Arbeitskopie)
@@ -169,11 +169,11 @@
       String prefix) throws IOException, ServletException {
     String fileName = themeUrl.toString();
     int index = fileName.indexOf("!");
+    String protocol = themeUrl.getProtocol();
     if (index != -1) {
-      fileName = themeUrl.toString().substring(themeUrl.getProtocol().length() + 1, fileName.indexOf("!"));
+      fileName = fileName.substring(protocol.length() + 1, index);
     }
-
-    if (fileName.endsWith(META_INF_TOBAGO_THEME_XML)) {
+    if (!protocol.equals("vfszip") && fileName.endsWith(META_INF_TOBAGO_THEME_XML)) {
       try {
         URI uri = themeUrl.toURI();
         File tobagoThemeXml = new File(uri);
@@ -186,6 +186,9 @@
     } else {
       URL jarFile;
       try {
+        if (protocol.equals("vfszip")) {
+          fileName = new File(fileName).getParentFile().getParentFile().getPath();
+        }
         jarFile = new URL(fileName);
       } catch (MalformedURLException e) {
         // workaround for weblogic on windows

Reply via email to