cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r667201 - in /cxf/branches/2.0.x-fixes: ./ common/schemas/src/main/resources/schemas/wsdl/ rt/core/src/main/java/org/apache/cxf/transport/http/ rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/ systests/src/test/ja...
Date Thu, 12 Jun 2008 18:59:59 GMT
Author: dkulp
Date: Thu Jun 12 11:59:59 2008
New Revision: 667201

URL: http://svn.apache.org/viewvc?rev=667201&view=rev
Log:
Merged revisions 667197 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r667197 | dkulp | 2008-06-12 14:51:45 -0400 (Thu, 12 Jun 2008) | 2 lines
  
  [CXF-1644] Return a real error message if the wsdl/schema isn't found in the maps instead
of a NPE
........

Modified:
    cxf/branches/2.0.x-fixes/   (props changed)
    cxf/branches/2.0.x-fixes/common/schemas/src/main/resources/schemas/wsdl/ws-addr-wsdl.xjb
    cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/QueryMessages.properties
    cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
    cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/PublishedEndpointUrlTest.java

Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.0.x-fixes/common/schemas/src/main/resources/schemas/wsdl/ws-addr-wsdl.xjb
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/common/schemas/src/main/resources/schemas/wsdl/ws-addr-wsdl.xjb?rev=667201&r1=667200&r2=667201&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/common/schemas/src/main/resources/schemas/wsdl/ws-addr-wsdl.xjb
(original)
+++ cxf/branches/2.0.x-fixes/common/schemas/src/main/resources/schemas/wsdl/ws-addr-wsdl.xjb
Thu Jun 12 11:59:59 2008
@@ -28,6 +28,6 @@
         </jaxb:schemaBindings>
     </jaxb:bindings>
     <jaxb:bindings schemaLocation="ws-addr-wsdl.xsd" node="/xs:schema/xs:element[@name='UsingAddressing']">
-      <jaxb:class ref="org.apache.cxf.ws.addressing.wsdl.UsingAddressingImpl"/>
+      <jaxb:class ref="org.apache.cxf.ws.addressing.wsdl.UsingAddressing"/>
     </jaxb:bindings>
 </jaxb:bindings>

Modified: cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/QueryMessages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/QueryMessages.properties?rev=667201&r1=667200&r2=667201&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/QueryMessages.properties
(original)
+++ cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/QueryMessages.properties
Thu Jun 12 11:59:59 2008
@@ -19,3 +19,5 @@
 #
 #
 COULD_NOT_PROVIDE_WSDL = Exception occurred while trying to process {0}
+WSDL_NOT_FOUND = Could not find wsdl {0}
+SCHEMA_NOT_FOUND = Could not find xsd {0}

Modified: cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java?rev=667201&r1=667200&r2=667201&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
Thu Jun 12 11:59:59 2008
@@ -148,7 +148,12 @@
                     String wsdl2 = resolveWithCatalogs(OASISCatalogManager.getCatalogManager(bus),
                                                        wsdl,
                                                        base);
-                    def = mp.get(wsdl2);
+                    if (wsdl2 != null) {
+                        def = mp.get(wsdl2);
+                    }
+                }
+                if (def == null) {
+                    throw new WSDLQueryException(new Message("WSDL_NOT_FOUND", LOG, wsdl),
null);
                 }
                 
                 synchronized (def) {
@@ -171,7 +176,12 @@
                     String xsd2 = resolveWithCatalogs(OASISCatalogManager.getCatalogManager(bus),
                                                        xsd,
                                                        base);
-                    si = smp.get(xsd2);
+                    if (xsd2 != null) { 
+                        si = smp.get(xsd2);
+                    }
+                }
+                if (si == null) {
+                    throw new WSDLQueryException(new Message("SCHEMA_NOT_FOUND", LOG, wsdl),
null);
                 }
                 
                 String uri = si.getReferencedSchema().getDocumentBaseURI();
@@ -188,37 +198,7 @@
                 doc = XMLUtils.getParser().parse(src);
             }
             
-            NodeList nl = doc.getDocumentElement()
-                .getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema",
-                                        "import");
-            for (int x = 0; x < nl.getLength(); x++) {
-                Element el = (Element)nl.item(x);
-                String sl = el.getAttribute("schemaLocation");
-                if (smp.containsKey(sl)) {
-                    el.setAttribute("schemaLocation", base + "?xsd=" + sl);
-                }
-            }
-            nl = doc.getDocumentElement()
-                .getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema",
-                                        "include");
-            for (int x = 0; x < nl.getLength(); x++) {
-                Element el = (Element)nl.item(x);
-                String sl = el.getAttribute("schemaLocation");
-                if (smp.containsKey(sl)) {
-                    el.setAttribute("schemaLocation", base + "?xsd=" + sl);
-                }
-            }
-            nl = doc.getDocumentElement()
-                .getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/",
-                                    "import");
-            for (int x = 0; x < nl.getLength(); x++) {
-                Element el = (Element)nl.item(x);
-                String sl = el.getAttribute("location");
-                if (mp.containsKey(sl)) {
-                    el.setAttribute("location", base + "?wsdl=" + sl);
-                }
-            }
-            doc.setXmlStandalone(true);
+            updateDoc(doc, base, mp, smp);
             String enc = doc.getXmlEncoding();
             if (enc == null) {
                 enc = "utf-8";
@@ -228,12 +208,50 @@
                                                                      enc);
             StaxUtils.writeNode(doc, writer, true);
             writer.flush();
+        } catch (WSDLQueryException wex) {
+            throw wex;
         } catch (Exception wex) {
             throw new WSDLQueryException(new Message("COULD_NOT_PROVIDE_WSDL",
                                                      LOG,
                                                      baseUri), wex);
         }
     }
+    
+    private void updateDoc(Document doc, String base,
+                           Map<String, Definition> mp,
+                           Map<String, SchemaReference> smp) {
+        NodeList nl = doc.getDocumentElement()
+            .getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema",
+                                    "import");
+        for (int x = 0; x < nl.getLength(); x++) {
+            Element el = (Element)nl.item(x);
+            String sl = el.getAttribute("schemaLocation");
+            if (smp.containsKey(sl)) {
+                el.setAttribute("schemaLocation", base + "?xsd=" + sl);
+            }
+        }
+        nl = doc.getDocumentElement()
+            .getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema",
+                                    "include");
+        for (int x = 0; x < nl.getLength(); x++) {
+            Element el = (Element)nl.item(x);
+            String sl = el.getAttribute("schemaLocation");
+            if (smp.containsKey(sl)) {
+                el.setAttribute("schemaLocation", base + "?xsd=" + sl);
+            }
+        }
+        nl = doc.getDocumentElement()
+            .getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/",
+                                "import");
+        for (int x = 0; x < nl.getLength(); x++) {
+            Element el = (Element)nl.item(x);
+            String sl = el.getAttribute("location");
+            if (mp.containsKey(sl)) {
+                el.setAttribute("location", base + "?wsdl=" + sl);
+            }
+        }
+        doc.setXmlStandalone(true);
+    }
 
     static String resolveWithCatalogs(OASISCatalogManager catalogs, String start, String
base) {
         String resolvedSchemaLocation = null;

Modified: cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java?rev=667201&r1=667200&r2=667201&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
Thu Jun 12 11:59:59 2008
@@ -230,6 +230,11 @@
                             qh.writeResponse(requestURL, pathInfo, endpointInfo, resp.getOutputStream());
                         } catch (Exception ex) {
                             LOG.log(Level.WARNING, "writeResponse failed: ", ex);
+                            try {
+                                resp.sendError(500, ex.getMessage());
+                            } catch (IOException ioe) {
+                                //ignore
+                            }
                         }
                         endpointInfo.setAddress(oldAddress);
                         resp.getOutputStream().flush();                     

Modified: cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/PublishedEndpointUrlTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/PublishedEndpointUrlTest.java?rev=667201&r1=667200&r2=667201&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/PublishedEndpointUrlTest.java
(original)
+++ cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/PublishedEndpointUrlTest.java
Thu Jun 12 11:59:59 2008
@@ -18,6 +18,8 @@
  */
 package org.apache.cxf.systest.http;
 
+import java.net.HttpURLConnection;
+import java.net.URL;
 import java.util.Collection;
 import java.util.List;
 
@@ -55,6 +57,11 @@
 
         WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
         wsdlReader.setFeature("javax.wsdl.verbose", false);
+        
+        URL url = new URL(svrFactory.getAddress() + "?wsdl=1");
+        HttpURLConnection connect = (HttpURLConnection)url.openConnection();
+        assertEquals(500, connect.getResponseCode());
+        
         Definition wsdl = wsdlReader.readWSDL(svrFactory.getAddress() + "?wsdl");
         assertNotNull(wsdl);
         



Mime
View raw message