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 ke...@apache.org on 2008/04/02 04:11:04 UTC

svn commit: r643685 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java

Author: keithc
Date: Tue Apr  1 19:11:02 2008
New Revision: 643685

URL: http://svn.apache.org/viewvc?rev=643685&view=rev
Log:
Throwing the errors during WSDL parsing.


Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java?rev=643685&r1=643684&r2=643685&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java Tue Apr  1 19:11:02 2008
@@ -33,7 +33,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.woden.WSDLException;
-import org.apache.woden.WSDLFactory;
 import org.apache.woden.WSDLReader;
 import org.apache.woden.WSDLSource;
 import org.apache.woden.XMLElement;
@@ -153,7 +152,12 @@
             fullPath = file.getAbsolutePath();
         }
         setBaseUri(fullPath);
-        Description description = readInTheWSDLFile(fullPath);
+        Description description;
+        try {
+            description = readInTheWSDLFile(fullPath);
+        } catch (AxisFault axisFault) {
+            throw new WSDLException("ERROR", "Exception occured while reading WSDL 2.0 doc", axisFault);
+        }
 
         DescriptionElement descriptionElement = description.toElement();
         savedTargetNamespace = descriptionElement.getTargetNamespace()
@@ -196,7 +200,7 @@
     /**
      * sets a custom WSDL locator
      *
-     * @param customResolver
+     * @param customResolver - A custom Resolver that can resolve imports and includes
      */
     public void setCustomWSDLResolver(URIResolver customResolver) {
         this.customWSDLResolver = customResolver;
@@ -391,7 +395,7 @@
         axisEndpoint.setName(endpoint.getName().toString());
         setEndpointURL(axisEndpoint, endpoint.getAddress().toString());
         Binding binding = endpoint.getBinding();
-        AxisBinding axisBinding = null;
+        AxisBinding axisBinding;
         if (processedBindings.containsKey(binding.getName())) {
             axisBinding = (AxisBinding) processedBindings.get(binding.getName());
         } else {
@@ -410,7 +414,7 @@
     }
 
     private void processSOAPBindingEndpointExtensions(Endpoint endpoint, AxisEndpoint axisEndpoint) throws AxisFault {
-        SOAPEndpointExtensions soapEndpointExtensions = null;
+        SOAPEndpointExtensions soapEndpointExtensions;
         try {
             soapEndpointExtensions = (SOAPEndpointExtensions) endpoint
                     .getComponentExtensionContext(new URI(WSDL2Constants.URI_WSDL2_SOAP));
@@ -427,7 +431,7 @@
     }
 
     private void processHTTPBindingEndpointExtensions(Endpoint endpoint, AxisEndpoint axisEndpoint) throws AxisFault {
-        HTTPEndpointExtensions httpEndpointExtensions = null;
+        HTTPEndpointExtensions httpEndpointExtensions;
         try {
             httpEndpointExtensions = (HTTPEndpointExtensions) endpoint
                     .getComponentExtensionContext(new URI(WSDL2Constants.URI_WSDL2_HTTP));
@@ -1153,41 +1157,41 @@
         }
     }
 
-    private Description readInTheWSDLFile(String wsdlURI) throws WSDLException {
+    private Description readInTheWSDLFile(String wsdlURI) throws WSDLException, AxisFault {
         DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
                 .newInstance();
         documentBuilderFactory.setNamespaceAware(true);
         DocumentBuilder documentBuilder;
-        Document document = null;
+        Document document;
         try {
             documentBuilder = documentBuilderFactory.newDocumentBuilder();
             document = documentBuilder.parse(wsdlURI);
         } catch (ParserConfigurationException e) {
-            AxisFault.makeFault(e);
+            throw AxisFault.makeFault(e);
         } catch (IOException e) {
-            AxisFault.makeFault(e);
+            throw AxisFault.makeFault(e);
         } catch (SAXException e) {
-            AxisFault.makeFault(e);
+            throw AxisFault.makeFault(e);
         }
         return readInTheWSDLFile(document);
     }
 
-    private Description readInTheWSDLFile(InputStream inputStream) throws WSDLException {
+    private Description readInTheWSDLFile(InputStream inputStream) throws WSDLException, AxisFault {
 
        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
                 .newInstance();
         documentBuilderFactory.setNamespaceAware(true);
         DocumentBuilder documentBuilder;
-        Document document = null;
+        Document document;
         try {
             documentBuilder = documentBuilderFactory.newDocumentBuilder();
             document = documentBuilder.parse(inputStream);
         } catch (ParserConfigurationException e) {
-            AxisFault.makeFault(e);
+            throw AxisFault.makeFault(e);
         } catch (IOException e) {
-            AxisFault.makeFault(e);
+            throw AxisFault.makeFault(e);
         } catch (SAXException e) {
-            AxisFault.makeFault(e);
+            throw AxisFault.makeFault(e);
         }
         return readInTheWSDLFile(document);
     }



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