You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by jk...@apache.org on 2006/02/07 14:07:01 UTC

svn commit: r375592 - /incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java

Author: jkaputin
Date: Tue Feb  7 05:06:26 2006
New Revision: 375592

URL: http://svn.apache.org/viewcvs?rev=375592&view=rev
Log:
Modified calls to XmlSchemaCollection.read to include
a baseURI argument, per the fix  for JIRA WSCOMMONS-1 
applied to XmlSchema. Also tidied up the use of 
URIs and URL strings in the DOMWSDLReader methods
parseSchemaInline, parseSchemaImport and 
getWSDLFromLocation.

Modified:
    incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java

Modified: incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java?rev=375592&r1=375591&r2=375592&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java (original)
+++ incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java Tue Feb  7 05:06:26 2006
@@ -456,17 +456,16 @@
             schema.setNamespace(getURI(tns));
         }
         
+        String baseURI = desc.getDocumentBaseURI() != null ?
+                         desc.getDocumentBaseURI().toString() : null;
         XmlSchema schemaDef = null;
         
         try {
             XmlSchemaCollection xsc = new XmlSchemaCollection();
-            schemaDef = xsc.read(schemaEl);
+            schemaDef = xsc.read(schemaEl, baseURI);
         } 
         catch (XmlSchemaException e) 
         {
-            String baseURI = desc.getDocumentBaseURI() != null ?
-                             desc.getDocumentBaseURI().toString() : "null";
-                    
             getErrorReporter().reportError(
                     new ErrorLocatorImpl(),  //TODO line&col nos.
                     "WSDL521", 
@@ -535,25 +534,24 @@
         
         Document importedSchemaDoc = null;
         Element schemaEl = null;
+        URI contextURI = null;
+        String schemaLoc = null;
         URL url = null;
         
         try 
         {
-            String contextURI = desc.getDocumentBaseURI().toString();
-            URL contextURL = (contextURI != null) ? 
-                    StringUtils.getURL(null, contextURI) : null;
-            url = StringUtils.getURL(contextURL, schema.getSchemaLocation().toString());
+            contextURI = desc.getDocumentBaseURI();
+            URL contextURL = (contextURI != null) ? contextURI.toURL() : null;
+            schemaLoc = schema.getSchemaLocation().toString();
+            url = StringUtils.getURL(contextURL, schemaLoc);
                     
         } catch (MalformedURLException e) {
-            
-            String locURI = schema.getSchemaLocation().toString();
-            String baseURI = desc.getDocumentBaseURI() != null ?
-                             desc.getDocumentBaseURI().toString() : "null";
-                    
+ 
+            String baseLoc = contextURI != null ? contextURI.toString() : null;
             getErrorReporter().reportError(
                     new ErrorLocatorImpl(),  //TODO line&col nos.
                     "WSDL502", 
-                    new Object[] {baseURI, locURI}, 
+                    new Object[] {baseLoc, schemaLoc}, 
                     ErrorReporter.SEVERITY_ERROR);
                     
             //can't continue schema retrieval with a bad URL.
@@ -590,8 +588,9 @@
             schemaEl = importedSchemaDoc.getDocumentElement();
             
             try {
+                String baseLoc = contextURI != null ? contextURI.toString() : null;
                 XmlSchemaCollection xsc = new XmlSchemaCollection();
-                schemaDef = xsc.read(schemaEl);
+                schemaDef = xsc.read(schemaEl, baseLoc);
                 fImportedSchemas.put(schemaURL, schemaDef);
             } 
             catch (XmlSchemaException e) 
@@ -2063,30 +2062,30 @@
         Element docEl;
         InputSource inputSource = null;
         URL locationURL = null;
-        String locationStr = null;
+        URI contextURI = null;
         
         try 
         {
-            URI contextURI = desc.getDocumentBaseURI();
+            contextURI = desc.getDocumentBaseURI();
             URL contextURL = (contextURI != null) ? contextURI.toURL() : null;
             locationURL = StringUtils.getURL(contextURL, locationURI);
-            locationStr = locationURL.toString();
         } 
         catch (MalformedURLException e) 
         {
-            String baseURI = desc.getDocumentBaseURI() != null ?
-                             desc.getDocumentBaseURI().toString() : "null";
-                    
-                    getErrorReporter().reportError(
-                            new ErrorLocatorImpl(),  //TODO line&col nos.
-                            "WSDL502", 
-                            new Object[] {baseURI, locationURI}, 
-                            ErrorReporter.SEVERITY_ERROR);
+            String baseURI = contextURI != null ? contextURI.toString() : null;
                     
-                    //can't continue import with a bad URL.
-                    return null;
+            getErrorReporter().reportError(
+                    new ErrorLocatorImpl(),  //TODO line&col nos.
+                    "WSDL502", 
+                    new Object[] {baseURI, locationURI}, 
+                    ErrorReporter.SEVERITY_ERROR);
+            
+            //can't continue import with a bad URL.
+            return null;
         }
         
+        String locationStr = locationURL.toString();
+
         //Check if WSDL imported or included previously from this location.
         referencedDesc = (DescriptionElement)wsdlModules.get(locationStr);
         



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