You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/05/19 17:51:53 UTC
svn commit: r946237 - in /cxf/branches/2.2.x-fixes: ./
common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
Author: dkulp
Date: Wed May 19 15:51:53 2010
New Revision: 946237
URL: http://svn.apache.org/viewvc?rev=946237&view=rev
Log:
Merged revisions 946235 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r946235 | dkulp | 2010-05-19 11:47:35 -0400 (Wed, 19 May 2010) | 1 line
Handle some cases where empty source objects are passed.
........
Modified:
cxf/branches/2.2.x-fixes/ (props changed)
cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=946237&r1=946236&r2=946237&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Wed May 19 15:51:53 2010
@@ -352,28 +352,42 @@ public final class StaxUtils {
}
public static void copy(Source source, XMLStreamWriter writer) throws XMLStreamException {
if (source instanceof SAXSource) {
- InputSource src = ((SAXSource)source).getInputSource();
- if (src.getSystemId() == null && src.getPublicId() == null
- && ((SAXSource)source).getXMLReader() != null) {
- //OK - reader is OK. We'll use that out
- StreamWriterContentHandler ch = new StreamWriterContentHandler(writer);
- XMLReader reader = ((SAXSource)source).getXMLReader();
- reader.setContentHandler(ch);
- try {
+ SAXSource ss = (SAXSource)source;
+ InputSource src = ss.getInputSource();
+ if (src == null || (src.getSystemId() == null && src.getPublicId() == null)) {
+ if (ss.getXMLReader() != null) {
+ //OK - reader is OK. We'll use that out
+ StreamWriterContentHandler ch = new StreamWriterContentHandler(writer);
+ XMLReader reader = ((SAXSource)source).getXMLReader();
+ reader.setContentHandler(ch);
try {
- reader.setFeature("http://xml.org/sax/features/namespaces", true);
- } catch (Throwable t) {
- //ignore
+ try {
+ reader.setFeature("http://xml.org/sax/features/namespaces", true);
+ } catch (Throwable t) {
+ //ignore
+ }
+ reader.parse(((SAXSource)source).getInputSource());
+ return;
+ } catch (Exception e) {
+ throw new XMLStreamException(e);
}
- reader.parse(((SAXSource)source).getInputSource());
+ } else if (ss.getInputSource() == null) {
+ //nothing to copy, just return
return;
- } catch (Exception e) {
- throw new XMLStreamException(e);
}
}
}
-
+
+ if (source instanceof StreamSource) {
+ StreamSource ss = (StreamSource)source;
+ if (ss.getInputStream() == null
+ && ss.getReader() == null
+ && ss.getSystemId() == null) {
+ //nothing to copy, just return
+ return;
+ }
+ }
XMLStreamReader reader = createXMLStreamReader(source);
copy(reader, writer);
reader.close();
Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?rev=946237&r1=946236&r2=946237&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java Wed May 19 15:51:53 2010
@@ -262,7 +262,7 @@ public class DispatchImpl<T> implements
}
Object ret[] = client.invokeWrapped(opName,
obj);
- if (isOneWay) {
+ if (isOneWay || ret == null || ret.length == 0) {
return null;
}
return (T)ret[0];