cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r644795 - in /incubator/cxf/trunk/rt: core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
Date Fri, 04 Apr 2008 17:53:59 GMT
Author: dkulp
Date: Fri Apr  4 10:53:50 2008
New Revision: 644795

URL: http://svn.apache.org/viewvc?rev=644795&view=rev
Log:
Fix error logging for exception from QueryHandlers
Change to using Stax to write wsdls

Modified:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java?rev=644795&r1=644794&r2=644795&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
Fri Apr  4 10:53:50 2008
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.transport.http;
 
-import java.io.IOException;
 import java.io.OutputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -34,7 +33,6 @@
 import javax.wsdl.Port;
 import javax.wsdl.Service;
 import javax.wsdl.Types;
-import javax.wsdl.WSDLException;
 import javax.wsdl.extensions.ExtensibilityElement;
 import javax.wsdl.extensions.schema.Schema;
 import javax.wsdl.extensions.schema.SchemaImport;
@@ -43,15 +41,13 @@
 import javax.wsdl.extensions.soap12.SOAP12Address;
 import javax.wsdl.xml.WSDLWriter;
 import javax.xml.namespace.QName;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.dom.DOMSource;
+import javax.xml.stream.XMLStreamWriter;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
 import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.catalog.OASISCatalogManager;
@@ -60,6 +56,7 @@
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.transports.http.StemMatchingQueryHandler;
 import org.apache.cxf.wsdl.WSDLManager;
 import org.apache.cxf.wsdl11.ResourceManagerWSDLLocator;
@@ -214,23 +211,19 @@
                 }
             }
             doc.setXmlStandalone(true);
-            XMLUtils.writeTo(new DOMSource(doc), os);
-        } catch (WSDLException wex) {
+            String enc = doc.getXmlEncoding();
+            if (enc == null) {
+                enc = "utf-8";
+            }
+
+            XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(os,
+                                                                     enc);
+            StaxUtils.writeNode(doc, writer, true);
+            writer.flush();
+        } catch (Exception wex) {
             throw new WSDLQueryException(new Message("COULD_NOT_PROVIDE_WSDL",
                                                      LOG,
                                                      baseUri), wex);
-        } catch (SAXException e) {
-            throw new WSDLQueryException(new Message("COULD_NOT_PROVIDE_WSDL",
-                                                     LOG,
-                                                     baseUri), e);
-        } catch (IOException e) {
-            throw new WSDLQueryException(new Message("COULD_NOT_PROVIDE_WSDL",
-                                                     LOG,
-                                                     baseUri), e);
-        } catch (ParserConfigurationException e) {
-            throw new WSDLQueryException(new Message("COULD_NOT_PROVIDE_WSDL",
-                                                     LOG,
-                                                     baseUri), e);
         }
     }
 

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?rev=644795&r1=644794&r2=644795&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
Fri Apr  4 10:53:50 2008
@@ -135,14 +135,15 @@
                             OutputStream out = res.getOutputStream();
                             try {
                                 qh.writeResponse(baseUri, ctxUri, ei, out);
-                                out.flush();
-                                return;
                             } catch (Exception e) {
-                                //throw new ServletException(e);
-                                LOG.warning(qh.getClass().getName() 
-                                    + " Exception caught writing response: " 
-                                    + e.getMessage());
+                                LogUtils.log(LOG, Level.WARNING,
+                                             qh.getClass().getName() 
+                                             + " Exception caught writing response.",
+                                             e);
+                                throw new ServletException(e);                          
     
                             }
+                            out.flush();
+                            return;
                         }   
                     }
                 }



Mime
View raw message