axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r469369 - in /webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment: repository/util/ArchiveReader.java resolver/AARBasedWSDLLocator.java resolver/AARFileBasedURIResolver.java util/Utils.java
Date Tue, 31 Oct 2006 04:43:10 GMT
Author: dims
Date: Mon Oct 30 20:43:10 2006
New Revision: 469369

URL: http://svn.apache.org/viewvc?view=rev&rev=469369
Log:
Fix for AXIS2-1556 - DeploymentException with segmented wsdl files

- Behave better if there are multiple hierarchical wsdl's.
- Behave better if there is a "./xyz.wsdl" or "./xyz.xsd"


Modified:
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/resolver/AARFileBasedURIResolver.java
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java?view=diff&rev=469369&r1=469368&r2=469369
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
(original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
Mon Oct 30 20:43:10 2006
@@ -199,7 +199,11 @@
             }
             return axisServiceBuilder.populateService();
         } catch (AxisFault axisFault) {
-            throw new DeploymentException(axisFault);
+            log.info("Trouble processing wsdl file :" + axisFault.getMessage());
+            if(log.isDebugEnabled()) {
+                log.debug(axisFault);
+            }
+            return null;
         }
     }
 
@@ -285,10 +289,10 @@
                                 new DeploymentException(Messages.getMessage("invalidWSDLFound"));
                             }
                             AxisService service = processWSDLFile(wsdlToAxisServiceBuilder,
serviceFile, true, new ByteArrayInputStream(out.toByteArray()));
-                            servicesMap.put(service.getName(), service);
+                            if(service != null) {
+                                servicesMap.put(service.getName(), service);
+                            }
                         }
-
-
                     }
                 }
                 try {
@@ -349,7 +353,9 @@
                     } catch (IOException e) {
                         log.info(e);
                     }
-                    servicesMap.put(service.getName(), service);
+                    if(service != null) {
+                        servicesMap.put(service.getName(), service);
+                    }
                 }
 
                 try {

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java?view=diff&rev=469369&r1=469368&r2=469369
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java
(original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/resolver/AARBasedWSDLLocator.java
Mon Oct 30 20:43:10 2006
@@ -78,6 +78,7 @@
                 if (parentLocation != null && parentLocation.length() > 0) {
                     importLocation = Utils.getPath(parentLocation, importLocation);
                 }
+                importLocation = Utils.normalize(importLocation);
                 while ((entry = zin.getNextEntry()) != null) {
                     String entryName = entry.getName().toLowerCase();
                     searchingStr = (DeploymentConstants.META_INF + "/" + importLocation).toLowerCase();

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/resolver/AARFileBasedURIResolver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/resolver/AARFileBasedURIResolver.java?view=diff&rev=469369&r1=469368&r2=469369
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/resolver/AARFileBasedURIResolver.java
(original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/resolver/AARFileBasedURIResolver.java
Mon Oct 30 20:43:10 2006
@@ -82,6 +82,7 @@
                 if (baseUri != null && baseUri.length() > 0) {
                     schemaLocation = Utils.getPath(baseUri, schemaLocation);
                 }
+                schemaLocation = Utils.normalize(schemaLocation);
                 while ((entry = zin.getNextEntry()) != null) {
                     String entryName = entry.getName().toLowerCase();
                     searchingStr = (DeploymentConstants.META_INF + "/" + schemaLocation).toLowerCase();

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?view=diff&rev=469369&r1=469368&r2=469369
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
(original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
Mon Oct 30 20:43:10 2006
@@ -458,6 +458,53 @@
         }
     }
 
+    /**
+     * Normalize a uri containing ../ and ./ paths.
+     *
+     * @param uri The uri path to normalize
+     * @return The normalized uri
+     */
+    public static String normalize(String uri) {
+        if ("".equals(uri)) {
+            return uri;
+        }
+        int leadingSlashes = 0;
+        for (leadingSlashes = 0 ; leadingSlashes < uri.length()
+                && uri.charAt(leadingSlashes) == '/' ; ++leadingSlashes) {}
+        boolean isDir = (uri.charAt(uri.length() - 1) == '/');
+        StringTokenizer st = new StringTokenizer(uri, "/");
+        LinkedList clean = new LinkedList();
+        while (st.hasMoreTokens()) {
+            String token = st.nextToken();
+            if ("..".equals(token)) {
+                if (! clean.isEmpty() && ! "..".equals(clean.getLast())) {
+                    clean.removeLast();
+                    if (! st.hasMoreTokens()) {
+                        isDir = true;
+                    }
+                } else {
+                    clean.add("..");
+                }
+            } else if (! ".".equals(token) && ! "".equals(token)) {
+                clean.add(token);
+            }
+        }
+        StringBuffer sb = new StringBuffer();
+        while (leadingSlashes-- > 0) {
+            sb.append('/');
+        }
+        for (Iterator it = clean.iterator() ; it.hasNext() ; ) {
+            sb.append(it.next());
+            if (it.hasNext()) {
+                sb.append('/');
+            }
+        }
+        if (isDir && sb.length() > 0 && sb.charAt(sb.length() - 1) !=
'/') {
+            sb.append('/');
+        }
+        return sb.toString();
+    }
+
     public static String getPath(String parent, String childPath) {
         Stack parentStack = new Stack();
         Stack childStack = new Stack();



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message