This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch camel-2.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-2.22.x by this push:
     new a9f3c7f  [CAMEL-13376]camel-cxf - failure processor for custom 
exception handling cannot get the original message
a9f3c7f is described below

commit a9f3c7ffea14d338b333e1138505040f5a45c1f1
Author: Freeman Fang <freeman.f...@gmail.com>
AuthorDate: Mon May 27 13:49:49 2019 -0400

    [CAMEL-13376]camel-cxf - failure processor for custom exception handling 
cannot get the original message
    
    (cherry picked from commit b2092741930ce76ea2561a8bb076272ca4d97898)
    (cherry picked from commit 8f9f6e8ebbda3e4b6bfc9d1ca2a290b94678dd8e)
    (cherry picked from commit a7b1103915404579a1dfe906b2eb876bd86d2816)
---
 .../apache/camel/component/cxf/converter/CachedCxfPayload.java   | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git 
a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CachedCxfPayload.java
 
b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CachedCxfPayload.java
index d82fcac..427cb99 100644
--- 
a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CachedCxfPayload.java
+++ 
b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CachedCxfPayload.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.cxf.converter;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.ListIterator;
 import java.util.Map;
@@ -92,6 +93,14 @@ public class CachedCxfPayload<T> extends CxfPayload<T> 
implements StreamCache {
                 li.set(document);
             }
         }
+        try {
+            Field bodyField = 
getClass().getSuperclass().getDeclaredField("body");
+            bodyField.setAccessible(true);
+            bodyField.set(orig, getBodySources());
+            
+        } catch (NoSuchFieldException | IllegalAccessException e) {
+            LOG.debug("can't use reflection way to set body in CxfPayload", e);
+        }
     }
 
     private CachedCxfPayload(CachedCxfPayload<T> orig, Exchange exchange) 
throws IOException {

Reply via email to