[jbossws-commits] JBossWS SVN: r17133 - in container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices: deployers and 1 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Wed Dec 19 02:55:45 EST 2012


Author: alessio.soldano at jboss.com
Date: 2012-12-19 02:55:44 -0500 (Wed, 19 Dec 2012)
New Revision: 17133

Modified:
   container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/WSLogger.java
   container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSIntegrationProcessorJAXWS_JMS.java
   container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/util/VirtualFileAdaptor.java
Log:
[JBWS-3551] Impl failsafe methods


Modified: container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/WSLogger.java
===================================================================
--- container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/WSLogger.java	2012-12-19 07:47:36 UTC (rev 17132)
+++ container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/WSLogger.java	2012-12-19 07:55:44 UTC (rev 17133)
@@ -1,6 +1,6 @@
 /*
  * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
+ * Copyright 20112 Red Hat, Inc., and individual contributors
  * as indicated by the @author tags. See the copyright.txt file in the
  * distribution for a full listing of individual contributors.
  *
@@ -40,6 +40,7 @@
 
 /**
  * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:alessio.soldano at jboss.com">Alessio Soldano</a>
  */
 @MessageLogger(projectCode = "JBAS")
 public interface WSLogger extends BasicLogger {
@@ -261,5 +262,9 @@
     @LogMessage(level = WARN)
     @Message(id = 15596, value = "Multiple EJB3 endpoints in the same deployment with different declared security roles; be aware this might be a security risk if you're not controlling allowed roles (@RolesAllowed) on each ws endpoint method.")
     void multipleEndpointsWithDifferentDeclaredSecurityRoles();
+
+    @LogMessage(level = TRACE)
+    @Message(id = 15597, value = "Child '%s' not found for VirtualFile: %s")
+    void missingChild(String child, VirtualFile file);
     
 }
\ No newline at end of file

Modified: container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSIntegrationProcessorJAXWS_JMS.java
===================================================================
--- container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSIntegrationProcessorJAXWS_JMS.java	2012-12-19 07:47:36 UTC (rev 17132)
+++ container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSIntegrationProcessorJAXWS_JMS.java	2012-12-19 07:55:44 UTC (rev 17133)
@@ -99,11 +99,12 @@
         if (!map.isEmpty()) {
 
             for (String wsdlLocation : map.keySet()) {
-                try {
-                    final ResourceRoot resourceRoot = getWsdlResourceRoot(unit, wsdlLocation);
-                    if (resourceRoot == null) continue;
-                    final UnifiedVirtualFile uvf = new VirtualFileAdaptor(resourceRoot.getRoot());
-                    URL url = uvf.findChild(wsdlLocation).toURL();
+               final ResourceRoot resourceRoot = getWsdlResourceRoot(unit, wsdlLocation);
+                if (resourceRoot == null) continue;
+                final UnifiedVirtualFile uvf = new VirtualFileAdaptor(resourceRoot.getRoot());
+                UnifiedVirtualFile childUvf = uvf.findChildFailSafe(wsdlLocation);
+                if (childUvf != null) {
+                    URL url = childUvf.toURL();
                     SOAPAddressWSDLParser parser = new SOAPAddressWSDLParser(url);
                     for (AnnotationInstance ai : map.get(wsdlLocation)) {
                         String port = ai.value(PORT_NAME).asString();
@@ -127,7 +128,7 @@
                             endpointsMetaData.addEndpointMetaData(endpointMetaData);
                         }
                     }
-                } catch (Exception ignore) {
+                } else {
                     ROOT_LOGGER.cannotReadWsdl(wsdlLocation);
                 }
             }
@@ -141,7 +142,7 @@
         // NOOP
     }
 
-    private static ResourceRoot getWsdlResourceRoot(final DeploymentUnit unit, final String wsdlPath) throws MalformedURLException {
+    private static ResourceRoot getWsdlResourceRoot(final DeploymentUnit unit, final String wsdlPath) {
         final AttachmentList<ResourceRoot> resourceRoots = new AttachmentList<ResourceRoot>(ResourceRoot.class);
         final ResourceRoot root = unit.getAttachment(DEPLOYMENT_ROOT);
         resourceRoots.add(root);

Modified: container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/util/VirtualFileAdaptor.java
===================================================================
--- container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/util/VirtualFileAdaptor.java	2012-12-19 07:47:36 UTC (rev 17132)
+++ container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/util/VirtualFileAdaptor.java	2012-12-19 07:55:44 UTC (rev 17133)
@@ -1,6 +1,6 @@
 /*
  * JBoss, Home of Professional Open Source
- * Copyright 2010, JBoss Inc., and individual contributors as indicated
+ * Copyright 2012, JBoss Inc., and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
@@ -22,6 +22,7 @@
 package org.jboss.as.webservices.util;
 
 import static org.jboss.as.webservices.WSMessages.MESSAGES;
+import static org.jboss.as.webservices.WSLogger.ROOT_LOGGER;
 
 import java.io.IOException;
 import java.net.URL;
@@ -52,14 +53,32 @@
         return file;
     }
 
-    public UnifiedVirtualFile findChild(String child) throws IOException {
+    private UnifiedVirtualFile findChild(String child, boolean throwExceptionIfNotFound) throws IOException {
         final VirtualFile virtualFile = getFile();
         final VirtualFile childFile = file.getChild(child);
-        if (!childFile.exists())
-            throw MESSAGES.missingChild(child, virtualFile);
+        if (!childFile.exists()) {
+            if (throwExceptionIfNotFound) {
+                throw MESSAGES.missingChild(child, virtualFile);
+            } else {
+                if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.missingChild(child, virtualFile);
+                return null;
+            }
+        }
         return new VirtualFileAdaptor(childFile);
     }
 
+    public UnifiedVirtualFile findChild(String child) throws IOException {
+        return findChild(child, true);
+    }
+
+    public UnifiedVirtualFile findChildFailSafe(String child) {
+        try {
+            return findChild(child, false);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
     public URL toURL() {
         try {
             return getFile().toURL();



More information about the jbossws-commits mailing list