You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ve...@apache.org on 2009/03/03 11:48:20 UTC

svn commit: r749577 - in /webservices/axis2/branches/java/1_5: ./ modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java

Author: veithen
Date: Tue Mar  3 10:48:20 2009
New Revision: 749577

URL: http://svn.apache.org/viewvc?rev=749577&view=rev
Log:
Fix for AXIS2-4258 (Modules not getting loaded from classpath in websphere 6.1); merged from r748761. Thanks to Vijay Pandey for testing.

Modified:
    webservices/axis2/branches/java/1_5/   (props changed)
    webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java

Propchange: webservices/axis2/branches/java/1_5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar  3 10:48:20 2009
@@ -1 +1 @@
-/webservices/axis2/trunk/java:732924,732927,732939,733776,741873
+/webservices/axis2/trunk/java:732924,732927,732939,733776,741873,748761

Modified: webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java?rev=749577&r1=749576&r2=749577&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java (original)
+++ webservices/axis2/branches/java/1_5/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java Tue Mar  3 10:48:20 2009
@@ -119,17 +119,31 @@
             while (moduleURLs.hasMoreElements()) {
                 try {
                     URL url = (URL)moduleURLs.nextElement();
-                    String fileName = url.toString();
-                    if (fileName.startsWith("jar")) {
-                        url = ((java.net.JarURLConnection)url.openConnection()).getJarFileURL();
-                        fileName = url.toString();
-                    } else if (fileName.startsWith("file")) {
-                        fileName =
-                                fileName.substring(0, fileName.lastIndexOf("/META-INF/module.xml"));
-                    } else continue;
-
-                    log.debug("Deploying module from classpath at '" + fileName + "'");
-                    File f = new File(new URI(fileName));
+                    URI moduleURI;
+                    if (url.getProtocol().equals("file")) {
+                        String urlString = url.toString();
+                        moduleURI = new URI(urlString.substring(0,
+                                urlString.lastIndexOf("/META-INF/module.xml")));
+                    } else {
+                        // Check if the URL refers to an archive (such as
+                        // jar:file:/dir/some.jar!/META-INF/module.xml) and extract the
+                        // URL of the archive. In general the protocol will be "jar", but
+                        // some containers may use other protocols, e.g. WebSphere uses
+                        // "wsjar" (AXIS2-4258).
+                        String path = url.getPath();
+                        int idx = path.lastIndexOf("!/");
+                        if (idx != -1 && path.substring(idx+2).equals("META-INF/module.xml")) {
+                            moduleURI = new URI(path.substring(0, idx));
+                            if (!moduleURI.getScheme().equals("file")) {
+                                continue;
+                            }
+                        } else {
+                            continue;
+                        }
+                    }
+    
+                    log.debug("Deploying module from classpath at '" + moduleURI + "'");
+                    File f = new File(moduleURI);
                     addFileToDeploy(f, deployer, WSInfo.TYPE_MODULE);
 
                 } catch (URISyntaxException e) {