You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2006/03/29 17:17:24 UTC

svn commit: r389809 - /incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ResourceLocator.java

Author: lofwyr
Date: Wed Mar 29 07:17:21 2006
New Revision: 389809

URL: http://svn.apache.org/viewcvs?rev=389809&view=rev
Log:
fix weblogic bug: #TOBAGO-53

Modified:
    incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ResourceLocator.java

Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ResourceLocator.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ResourceLocator.java?rev=389809&r1=389808&r2=389809&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ResourceLocator.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ResourceLocator.java Wed Mar 29 07:17:21 2006
@@ -30,6 +30,7 @@
 import java.io.InputStream;
 import java.io.IOException;
 import java.net.URL;
+import java.net.MalformedURLException;
 
 /**
  * This class helps to locate all resources of the ResourceManager.
@@ -126,10 +127,20 @@
         String prefix = ensureSlash(theme.getResourcePath());
 
         // TODO other protocols
-        if ("jar".equals(themeUrl.getProtocol())) {
+        String protocol = themeUrl.getProtocol();
+        // tomcat uses jar
+        // weblogic uses zip
+        if ("jar".equals(protocol) || "zip".equals(protocol)) {
+          LOG.info("themeUrl = '" + themeUrl + "'");
           String fileName = themeUrl.toString().substring(4, themeUrl.toString().indexOf("!"));
           ClassLoader classLoader = ResourceManagerFactory.class.getClassLoader();
-          URL jarFile = new URL(fileName);
+          URL jarFile;
+          try {
+            jarFile = new URL(fileName);
+          } catch (MalformedURLException e) {
+            // workaround for weblogic on windows
+            jarFile = new URL("file:" + fileName);
+          }
           InputStream stream = null;
           try {
             stream = jarFile.openStream();
@@ -163,7 +174,7 @@
             IOUtils.closeQuietly(stream);
           }
         } else {
-          LOG.error("Unknown protocol "+themeUrl);
+          LOG.error("Unknown protocol '"+themeUrl + "'");
         }
       }
     } catch (Exception e) {