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 2014/07/11 21:11:44 UTC

[1/7] git commit: [CXF-5842] Make sure the cache gets cleaned up if it fails to cache the input

Repository: cxf
Updated Branches:
  refs/heads/2.6.x-fixes b6d8e0fbf -> ce7a84f5d


[CXF-5842] Make sure the cache gets cleaned up if it fails to cache the input

Conflicts:
	rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/MessageContextImpl.java


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/86b69487
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/86b69487
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/86b69487

Branch: refs/heads/2.6.x-fixes
Commit: 86b694872f46eb8c69480878eca4232cacae65d3
Parents: b6d8e0f
Author: Daniel Kulp <dk...@apache.org>
Authored: Wed Jul 9 10:58:33 2014 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Jul 11 14:49:22 2014 -0400

----------------------------------------------------------------------
 .../cxf/attachment/AttachmentDataSource.java    | 28 +++++++++++++++-----
 1 file changed, 22 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/86b69487/api/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java b/api/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java
index 42194f5..d1b64b8 100644
--- a/api/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java
+++ b/api/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java
@@ -26,6 +26,7 @@ import java.io.OutputStream;
 import javax.activation.DataSource;
 
 import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.io.CacheSizeExceededException;
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.message.Message;
 
@@ -49,12 +50,27 @@ public class AttachmentDataSource implements DataSource {
         if (cache == null) {
             cache = new CachedOutputStream();
             AttachmentUtil.setStreamedAttachmentProperties(message, cache);
-            IOUtils.copy(ins, cache);
-            cache.lockOutputStream();  
-            ins.close();
-            ins = null;
-            if (delegate != null) {
-                delegate.setInputStream(cache.getInputStream());
+            try {
+                IOUtils.copy(ins, cache);
+                cache.lockOutputStream();
+                if (delegate != null) {
+                    delegate.setInputStream(cache.getInputStream());
+                }
+            } catch (CacheSizeExceededException cee) {
+                cache.close();
+                cache = null;
+                throw cee;
+            } catch (IOException cee) {
+                cache.close();
+                cache = null;
+                throw cee;
+            } finally {
+                try {
+                    ins.close();                
+                } catch (Exception ex) {
+                    //ignore
+                }
+                ins = null;
             }
         }
     }


[4/7] git commit: [CXF-5873] Fix a problem of a ton of logs if the client pre-maturely closes a connection.

Posted by dk...@apache.org.
[CXF-5873] Fix a problem of a ton of logs if the client pre-maturely closes a connection.


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/489ac889
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/489ac889
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/489ac889

Branch: refs/heads/2.6.x-fixes
Commit: 489ac889947c265565eeaa116c04fd31b8c80b65
Parents: 2ede9f9
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Jul 11 12:47:45 2014 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Jul 11 14:50:49 2014 -0400

----------------------------------------------------------------------
 .../binding/soap/interceptor/SoapOutInterceptor.java   | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/489ac889/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
index 8aca085..fb0635b 100644
--- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
+++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
@@ -20,6 +20,7 @@
 package org.apache.cxf.binding.soap.interceptor;
 
 
+import java.io.EOFException;
 import java.io.OutputStream;
 import java.util.List;
 import java.util.Map;
@@ -285,6 +286,7 @@ public class SoapOutInterceptor extends AbstractSoapInterceptor {
             try {
                 XMLStreamWriter xtw = message.getContent(XMLStreamWriter.class);
                 if (xtw != null) {
+                    // Write body end
                     xtw.writeEndElement();            
                     // Write Envelope end element
                     xtw.writeEndElement();
@@ -293,9 +295,14 @@ public class SoapOutInterceptor extends AbstractSoapInterceptor {
                     xtw.flush();
                 }
             } catch (XMLStreamException e) {
-                SoapVersion soapVersion = message.getVersion();
-                throw new SoapFault(new org.apache.cxf.common.i18n.Message("XML_WRITE_EXC", BUNDLE), e,
-                                    soapVersion.getSender());
+                if (e.getCause() instanceof EOFException) {
+                    //Nothing we can do about this, some clients will close the connection early if 
+                    //they fully parse everything they need
+                } else {
+                    SoapVersion soapVersion = message.getVersion();
+                    throw new SoapFault(new org.apache.cxf.common.i18n.Message("XML_WRITE_EXC", BUNDLE), e,
+                                        soapVersion.getSender());
+                }
             }
         }
     }


[6/7] git commit: Recording .gitmergeinfo Changes

Posted by dk...@apache.org.
Recording .gitmergeinfo Changes


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/958bd747
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/958bd747
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/958bd747

Branch: refs/heads/2.6.x-fixes
Commit: 958bd74711da157d88b9cd3246b1c66dd82ba128
Parents: 0fd50ef
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Jul 11 14:50:57 2014 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Jul 11 14:50:57 2014 -0400

----------------------------------------------------------------------
 .gitmergeinfo | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/958bd747/.gitmergeinfo
----------------------------------------------------------------------
diff --git a/.gitmergeinfo b/.gitmergeinfo
index ca3b398..98d199e 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -275,6 +275,7 @@ B 3c841f203b873e46bfe10a6abd41a2d05758087d
 B 3ca8d16e687fbd9e671d7e0eccdf6624b966e32d
 B 3cf3bfa2a1962d7563f9a131c00186f9d68a3b7a
 B 3cf8bf8d0c6fd953ed9876f5e906bc06c12e671c
+B 3d24db16311236590d6216ccead5f29f592eaae6
 B 3d83ecda36ec92fc388129eaf3ef5f3141bb200d
 B 3db6ccfa87e64f8bf97d149d436bcacb9274567b
 B 3e2cbf6e88b0eb08ea33ca73f720a6124c2611a1
@@ -370,6 +371,7 @@ B 4fba5ce228b0ab45c2c03d808990ed06db3c5476
 B 5030a107ab210c11ffc15c2c499e8739fee6fd8f
 B 50df8dfde6365b092e65a482902d44c053c4d2f6
 B 51534a2ac4cb7686ae66f4a04e4a64e752d47c4d
+B 51546af28b71e109aae474c3b30c136b862a80f8
 B 51a3b3b6e56e12b45e12762f9e159671485e9dc5
 B 51e3aaaa5d02fbb0bd0edd1a5b2c6a4fdbb34429
 B 51eddeae2f6f9e0a5e62cfdcc4811e414483c084
@@ -392,6 +394,7 @@ B 55371304ee1a5c43c47635901e08d77610ec4914
 B 553795af1589eb46c51bd21ae7984e19aaa7a188
 B 553f64f07b083c779937231659cccb467c80710b
 B 5576a21718a07df18f02c918d38f40650aa731f3
+B 5576b8d197dde379b113c749dfb21f19628d913c
 B 558330f52fe8999bdad779da3eb29c2131c59133
 B 55bbc673bd2db12e245a06b677f85fed038399c4
 B 55ca636f27fe8d736ba0dd3d00308bcd31fbc1f6
@@ -573,6 +576,7 @@ B 7c690b493083fc1e271a737f4144e350a38a65b8
 B 7caa3969d928131e03591a3fe9250848d8110048
 B 7ceda035062a8e559e1eab69de6f19e224ba1824
 B 7d69d040de9e8bf8beaf06ffb4ecd6908eb17693
+B 7d7072dc78a35243adde9ad7caf43ccdcebcff1b
 B 7d9f038f5ac5dca27eaa8c0e2249fd4fcb46d579
 B 7da4a3e31f221d0d6a1790f8bbf42e63e6f7cb4a
 B 7db989c7bf06e3ba3eadb8d9291ad98b5d9c6549
@@ -878,6 +882,7 @@ B bc9de3057ff4c720719e81e259cc9e716abde885
 B bd22f91d264511588d1babb8afb178e2c88053ed
 B bd5658444f7eead34f068e65daf289158ca74c82
 B bd56e16846770bd7369f94be856d7f756cb380f5
+B bd5ba39e162b3b5720b70eb3b4d93e9f2a072180
 B bda818b86024e3aa50c2b9df712b41995b13fab1
 B be5043c8f0f7bb5566fae4b4737addf602ef82d9
 B beaa13d185126d67d751a009ac34436b69b2c7e0
@@ -885,6 +890,7 @@ B becdab108db28387b61bda75f03ce2f4ec697815
 B bef019c0397551bf0ec62b6d46fea3fd6f204aa5
 B bf18a65474392d1b4995aceee3d0708d4e9d32d9
 B bf67a3313899d7ae006880eef5772846cca16a13
+B bf78d113b947a663f1e6ad025d8ac5eb5fbe24cd
 B bf8fef3246adae67c48debe072ddc41ef5ed61a9
 B bf918e666e9a8804c2ee97cebf4fd4288c5c8b20
 B bfc63951deb1563840f135af055871af9db4d50c
@@ -918,6 +924,7 @@ B c5a89b7c137566c045a0d13b62132e987ff81b52
 B c5ede8a9f93bf96d056b6ec34462a8e8c42c1a89
 B c5ff01a14b9396336c4fe1b939bda7efdd896547
 B c6060bf6efecffa40e462b24a99ce1f92a7780bc
+B c61bff324caed93317bdd07cbb0849456e049c63
 B c6878bb4ca69aa4cec4282133926ba6434d3d6be
 B c6c6ebfbedbd245c69a889a9547761070a28fc65
 B c729193dd87698c7e499281ab7e33654f9f8c8f4
@@ -1420,6 +1427,7 @@ M 989f01bef7b518220a8137d168873052e9ff10f2
 M 98d240e94d8c954fc288d60ce9c5e68bc24c2c3b
 M 9acc2c32022908e0b6959e515b6e6a16dbe09864
 M 9b6d2d53a86d8fa2c9ca4dfdd0bbf4e15a22d536
+M 9c11b61bcbc9553a4220a345d7195889c3f697d5
 M 9cc14b301c7053c09fe26aeb679fd43f75dbc3a7
 M 9d7f61ad77291137144e40397b81011d5ebb086e
 M 9df6f87d6ad4d5221cfd5ba5e79cd0ad68492ff6
@@ -1568,6 +1576,7 @@ M ec8856a6535749449c27ba352a6d2cb4de565862
 M ec9b95eadfcc0088302105c12636e342aaedd431
 M ecb20404f606e072b735c495984ed2d8b5248812
 M ecd32ef0f18222030c49ec05849c62d911f5f378
+M ed9f2493fc831ef324096fe830fa78119ee72bef
 M efe2e52f59fe19deb7b5da61d0a420973a3f1345
 M f023c058f316eebacef308f029a62191e2d4f9f3
 M f02ee6bef0c5a2ec22c9b6834784dca78e07c7f0


[5/7] git commit: [CXF-5871] Fix checkstyle issue

Posted by dk...@apache.org.
[CXF-5871] Fix checkstyle issue


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/0fd50efe
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/0fd50efe
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/0fd50efe

Branch: refs/heads/2.6.x-fixes
Commit: 0fd50efe20914bb45fcb0bc29515d47138397f85
Parents: 489ac88
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Jul 11 13:02:57 2014 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Jul 11 14:50:51 2014 -0400

----------------------------------------------------------------------
 .../jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java      | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/0fd50efe/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
index 7433abe..aa9061b 100644
--- a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
+++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
@@ -296,7 +296,6 @@ public class DispatchImpl<T> implements Dispatch<T>, BindingProvider, Closeable
     
     @SuppressWarnings("unchecked")
     public T invoke(T obj, boolean isOneWay) {
-        StaxSource createdSource = null;
         checkError();        
         try {
             if (obj instanceof SOAPMessage) {


[7/7] git commit: Fix compile error after merge

Posted by dk...@apache.org.
Fix compile error after merge


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ce7a84f5
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ce7a84f5
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ce7a84f5

Branch: refs/heads/2.6.x-fixes
Commit: ce7a84f5d938c309b3cde12beb963092c1ee4642
Parents: 958bd74
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Jul 11 15:10:42 2014 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Jul 11 15:10:42 2014 -0400

----------------------------------------------------------------------
 .../src/main/java/org/apache/cxf/jaxws/DispatchImpl.java     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/ce7a84f5/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
index aa9061b..fd69e1b 100644
--- a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
+++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
@@ -344,18 +344,18 @@ public class DispatchImpl<T> implements Dispatch<T>, BindingProvider, Closeable
         // if the addressing feature is enabled, set findDispatchOp to true
         if (!findDispatchOp) {
             // the feature list to be searched is the endpoint and the bus's lists
-            List<Feature> endpointFeatures 
+            List<AbstractFeature> endpointFeatures
                 = ((JaxWsClientEndpointImpl)client.getEndpoint()).getFeatures();
-            List<Feature> allFeatures;
+            List<AbstractFeature> allFeatures;
             if (client.getBus().getFeatures() != null) {
-                allFeatures = new ArrayList<Feature>(endpointFeatures.size() 
+                allFeatures = new ArrayList<AbstractFeature>(endpointFeatures.size()
                     + client.getBus().getFeatures().size());
                 allFeatures.addAll(endpointFeatures);
                 allFeatures.addAll(client.getBus().getFeatures());
             } else {
                 allFeatures = endpointFeatures;
             }
-            for (Feature feature : allFeatures) {
+            for (AbstractFeature feature : allFeatures) {
                 if (feature instanceof WSAddressingFeature) {
                     findDispatchOp = true; 
                 }


[3/7] git commit: [CXF-5871] Fix dispatch.invokeAsync not sending proper Action

Posted by dk...@apache.org.
[CXF-5871] Fix dispatch.invokeAsync not sending proper Action

Conflicts:
	rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2ede9f90
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2ede9f90
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2ede9f90

Branch: refs/heads/2.6.x-fixes
Commit: 2ede9f90eb8e9a3ca4ec393b87353cd0d4be9422
Parents: 1da5667
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Jul 11 12:44:03 2014 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Jul 11 14:50:46 2014 -0400

----------------------------------------------------------------------
 .../java/org/apache/cxf/jaxws/DispatchImpl.java | 182 ++++++++++---------
 1 file changed, 99 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/2ede9f90/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
index c537a3d..7433abe 100644
--- a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
+++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
@@ -40,11 +40,13 @@ import javax.xml.soap.SOAPMessage;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Source;
 import javax.xml.ws.AsyncHandler;
 import javax.xml.ws.Binding;
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Dispatch;
 import javax.xml.ws.EndpointReference;
+import javax.xml.ws.Holder;
 import javax.xml.ws.Response;
 import javax.xml.ws.Service;
 import javax.xml.ws.WebServiceException;
@@ -54,6 +56,7 @@ import javax.xml.ws.http.HTTPBinding;
 import javax.xml.ws.http.HTTPException;
 import javax.xml.ws.soap.SOAPBinding;
 import javax.xml.ws.soap.SOAPFaultException;
+
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -306,7 +309,6 @@ public class DispatchImpl<T> implements Dispatch<T>, BindingProvider, Closeable
                 getRequestContext().put("unwrap.jaxb.element", unwrapProperty);
             }
             QName opName = (QName)getRequestContext().get(MessageContext.WSDL_OPERATION);
-            boolean findDispatchOp = Boolean.TRUE.equals(getRequestContext().get("find.dispatch.operation"));
             
             boolean hasOpName;
             if (opName == null) {
@@ -320,99 +322,106 @@ public class DispatchImpl<T> implements Dispatch<T>, BindingProvider, Closeable
                     addInvokeOperation(opName, isOneWay);
                 }
             }
+            Holder<T> holder = new Holder<T>(obj);
+            opName = calculateOpName(holder, opName, hasOpName);
             
-            //CXF-2836 : find the operation for the dispatched object
-            // if findDispatchOp is already true, skip the addressing feature lookup.
-            // if the addressing feature is enabled, set findDispatchOp to true
-            if (!findDispatchOp) {
-                // the feature list to be searched is the endpoint and the bus's lists
-                List<AbstractFeature> endpointFeatures 
-                    = ((JaxWsClientEndpointImpl)client.getEndpoint()).getFeatures();
-                List<AbstractFeature> allFeatures;
-                if (client.getBus().getFeatures() != null) {
-                    allFeatures = new ArrayList<AbstractFeature>(endpointFeatures.size() 
-                        + client.getBus().getFeatures().size());
-                    allFeatures.addAll(endpointFeatures);
-                    allFeatures.addAll(client.getBus().getFeatures());
-                } else {
-                    allFeatures = endpointFeatures;
-                }
-                for (AbstractFeature feature : allFeatures) {
-                    if (feature instanceof WSAddressingFeature) {
-                        findDispatchOp = true; 
-                    }
+            Object ret[] = client.invokeWrapped(opName,
+                                                holder.value);
+            if (isOneWay || ret == null || ret.length == 0) {
+                return null;
+            }
+            return (T)ret[0];
+        } catch (Exception ex) {
+            throw mapException(ex);
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    private QName calculateOpName(Holder<T> holder, QName opName, boolean hasOpName) throws XMLStreamException {
+        boolean findDispatchOp = Boolean.TRUE.equals(getRequestContext().get("find.dispatch.operation"));
+
+        //CXF-2836 : find the operation for the dispatched object
+        // if findDispatchOp is already true, skip the addressing feature lookup.
+        // if the addressing feature is enabled, set findDispatchOp to true
+        if (!findDispatchOp) {
+            // the feature list to be searched is the endpoint and the bus's lists
+            List<Feature> endpointFeatures 
+                = ((JaxWsClientEndpointImpl)client.getEndpoint()).getFeatures();
+            List<Feature> allFeatures;
+            if (client.getBus().getFeatures() != null) {
+                allFeatures = new ArrayList<Feature>(endpointFeatures.size() 
+                    + client.getBus().getFeatures().size());
+                allFeatures.addAll(endpointFeatures);
+                allFeatures.addAll(client.getBus().getFeatures());
+            } else {
+                allFeatures = endpointFeatures;
+            }
+            for (Feature feature : allFeatures) {
+                if (feature instanceof WSAddressingFeature) {
+                    findDispatchOp = true; 
                 }
             }
-            Map<String, QName> payloadOPMap = createPayloadEleOpNameMap(
-                    client.getEndpoint().getBinding().getBindingInfo(), hasOpName);
-            if (findDispatchOp && !payloadOPMap.isEmpty()) {
-                QName payloadElementName = null;
-                if (obj instanceof javax.xml.transform.Source) {
-                    XMLStreamReader reader = null;
-                    try {
-                        reader = StaxUtils.createXMLStreamReader((javax.xml.transform.Source)obj);
-                        Document document = StaxUtils.read(reader);
-                        createdSource = new StaxSource(StaxUtils.createXMLStreamReader(document));
-                        payloadElementName = getPayloadElementName(document.getDocumentElement());
-                    } catch (Exception e) {                        
-                        // ignore, we are trying to get the operation name
-                    } finally {
-                        StaxUtils.close(reader);
-                    }
+        }
+        Source createdSource = null;
+        Map<String, QName> payloadOPMap = createPayloadEleOpNameMap(
+                client.getEndpoint().getBinding().getBindingInfo(), hasOpName);
+        if (findDispatchOp && !payloadOPMap.isEmpty()) {
+            QName payloadElementName = null;
+            if (holder.value instanceof javax.xml.transform.Source) {
+                XMLStreamReader reader = null;
+                try {
+                    reader = StaxUtils.createXMLStreamReader((javax.xml.transform.Source)holder.value);
+                    Document document = StaxUtils.read(reader);
+                    createdSource = new StaxSource(StaxUtils.createXMLStreamReader(document));
+                    payloadElementName = getPayloadElementName(document.getDocumentElement());
+                } catch (Exception e) {                        
+                    // ignore, we are trying to get the operation name
+                } finally {
+                    StaxUtils.close(reader);
                 }
-                if (obj instanceof SOAPMessage) {
-                    payloadElementName = getPayloadElementName((SOAPMessage)obj);
+            }
+            if (holder.value instanceof SOAPMessage) {
+                payloadElementName = getPayloadElementName((SOAPMessage)holder.value);
 
-                }
+            }
 
-                if (this.context != null) {
-                    payloadElementName = getPayloadElementName(obj);
-                }
+            if (this.context != null) {
+                payloadElementName = getPayloadElementName(holder.value);
+            }
 
-                if (payloadElementName != null) {
-                    if (hasOpName) {
-                        // Verify the payload element against the given operation name.
-                        // This allows graceful handling of non-standard WSDL definitions
-                        // where different operations have the same payload element.
-                        QName expectedElementName = payloadOPMap.get(opName.toString());
-                        if (expectedElementName == null || !expectedElementName.toString().equals(
-                                payloadElementName.toString())) {
-                            // Verification of the provided operation name failed.
-                            // Resolve the operation name from the payload element.
-                            hasOpName = false;
-                            payloadOPMap = createPayloadEleOpNameMap(
-                                    client.getEndpoint().getBinding().getBindingInfo(), hasOpName);
-                        }
+            if (payloadElementName != null) {
+                if (hasOpName) {
+                    // Verify the payload element against the given operation name.
+                    // This allows graceful handling of non-standard WSDL definitions
+                    // where different operations have the same payload element.
+                    QName expectedElementName = payloadOPMap.get(opName.toString());
+                    if (expectedElementName == null || !expectedElementName.toString().equals(
+                            payloadElementName.toString())) {
+                        // Verification of the provided operation name failed.
+                        // Resolve the operation name from the payload element.
+                        hasOpName = false;
+                        payloadOPMap = createPayloadEleOpNameMap(
+                                client.getEndpoint().getBinding().getBindingInfo(), hasOpName);
                     }
-                    QName dispatchedOpName = null;
-                    if (!hasOpName) {
-                        dispatchedOpName = payloadOPMap.get(payloadElementName.toString());
-                    }
-                    if (null != dispatchedOpName) {
-                        BindingOperationInfo bop = client.getEndpoint().getBinding().getBindingInfo()
-                          .getOperation(opName);
-                        BindingOperationInfo dbop = client.getEndpoint().getBinding().getBindingInfo()
-                          .getOperation(dispatchedOpName);
-                        if (bop != null) {
-                            // set the actual binding operation object to this dispatch operation
-                            bop.setProperty("dispatchToOperation", dbop);
-                        }
+                }
+                QName dispatchedOpName = null;
+                if (!hasOpName) {
+                    dispatchedOpName = payloadOPMap.get(payloadElementName.toString());
+                }
+                if (null != dispatchedOpName) {
+                    BindingOperationInfo dbop = client.getEndpoint().getBinding().getBindingInfo()
+                        .getOperation(dispatchedOpName);
+                    if (dbop != null) {
+                        opName = dispatchedOpName;
                     }
                 }
-            } 
-            
-            
-            Object ret[] = client.invokeWrapped(opName,
-                                                createdSource == null ? obj : createdSource);
-            if (isOneWay || ret == null || ret.length == 0) {
-                return null;
             }
-            return (T)ret[0];
-        } catch (Exception ex) {
-            throw mapException(ex);
         }
+        if (createdSource != null) {
+            holder.value = (T)createdSource;
+        }
+        return opName;
     }
-
   
     public Future<?> invokeAsync(T obj, AsyncHandler<T> asyncHandler) {
         checkError();
@@ -421,11 +430,15 @@ public class DispatchImpl<T> implements Dispatch<T>, BindingProvider, Closeable
         ClientCallback callback = new JaxwsClientCallback<T>(asyncHandler, this);
              
         Response<T> ret = new JaxwsResponseCallback<T>(callback);
-        try {
+        try {           
+            boolean hasOpName;
+            
             QName opName = (QName)getRequestContext().get(MessageContext.WSDL_OPERATION);
             if (opName == null) {
+                hasOpName = false;
                 opName = INVOKE_QNAME;
             } else {
+                hasOpName = true;
                 BindingOperationInfo bop = client.getEndpoint().getBinding()
                     .getBindingInfo().getOperation(opName);
                 if (bop == null) {
@@ -433,9 +446,12 @@ public class DispatchImpl<T> implements Dispatch<T>, BindingProvider, Closeable
                 }
             }
 
+            Holder<T> holder = new Holder<T>(obj);
+            opName = calculateOpName(holder, opName, hasOpName);
+            
             client.invokeWrapped(callback, 
                                  opName,
-                                 obj);
+                                 holder.value);
             
             return ret;
         } catch (Exception ex) {


[2/7] git commit: [CXF-5872] Fix NPE when Dispatch clients trying to process a fault

Posted by dk...@apache.org.
[CXF-5872] Fix NPE when Dispatch clients trying to process a fault


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/1da5667b
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/1da5667b
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/1da5667b

Branch: refs/heads/2.6.x-fixes
Commit: 1da5667b895bcd94d115506921c504c97966af7f
Parents: 86b6948
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Jul 11 12:43:21 2014 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Jul 11 14:49:26 2014 -0400

----------------------------------------------------------------------
 .../java/org/apache/cxf/interceptor/ClientFaultConverter.java     | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/1da5667b/api/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java b/api/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
index 02e21e7..263cd0d 100644
--- a/api/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
+++ b/api/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
@@ -169,6 +169,9 @@ public class ClientFaultConverter extends AbstractPhaseInterceptor<Message> {
             
             try {
                 Class<?> exClass = faultWanted.getProperty(Class.class.getName(), Class.class);
+                if (exClass == null) {
+                    return;
+                }
                 if (e == null) { 
                     Constructor<?> constructor = exClass.getConstructor(new Class[]{String.class});
                     e = constructor.newInstance(new Object[]{fault.getMessage()});