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 2009/05/21 21:19:25 UTC

svn commit: r777224 - /cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptor.java

Author: dkulp
Date: Thu May 21 19:19:25 2009
New Revision: 777224

URL: http://svn.apache.org/viewvc?rev=777224&view=rev
Log:
[CXF-2228] Problem with the rootNode attribute on the xmlbinding stuff
not being consitent with single part messages between reading and
writing

Modified:
    cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptor.java

Modified: cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptor.java?rev=777224&r1=777223&r2=777224&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptor.java (original)
+++ cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptor.java Thu May 21 19:19:25 2009
@@ -108,7 +108,6 @@
                                                          BindingInfo bi, 
                                                          XMLStreamReader xsr) {
 
-        BindingOperationInfo match = null;
         for (BindingOperationInfo boi : bi.getOperations()) {
             BindingMessageInfo bmi;
             if (!isRequestor) {
@@ -118,41 +117,39 @@
             }
             
             if (hasRootNode(bmi, startQName)) {
-                match = boi;
                 //Consume The rootNode tag
                 try {
                     xsr.nextTag();
                 } catch (XMLStreamException xse) {
                     throw new Fault(new org.apache.cxf.common.i18n.Message("STAX_READ_EXC", LOG));
                 }
+                return boi;
             } else {
                 Collection<MessagePartInfo> bodyParts = bmi.getMessageParts();
                 if (bodyParts.size() == 1) {
                     MessagePartInfo p = bodyParts.iterator().next();
                     if (p.getConcreteName().equals(startQName)) {
-                        match = boi;
+                        return boi;
                     }
                 }
             }
         }
-        if (match == null) {
-            for (BindingOperationInfo boi : bi.getOperations()) {
-                if (startQName.equals(boi.getName())) {
-                    match = boi;
-                    //Consume The rootNode tag
-                    try {
-                        xsr.nextTag();
-                    } catch (XMLStreamException xse) {
-                        throw new Fault(new org.apache.cxf.common.i18n.Message("STAX_READ_EXC", LOG));
-                    }
+        for (BindingOperationInfo boi : bi.getOperations()) {
+            if (startQName.equals(boi.getName())) {
+                //Consume The rootNode tag
+                try {
+                    xsr.nextTag();
+                } catch (XMLStreamException xse) {
+                    throw new Fault(new org.apache.cxf.common.i18n.Message("STAX_READ_EXC", LOG));
                 }
-            } 
-        }
-        return match;
+                return boi;
+            }
+        } 
+        return null;
     }
 
     private boolean hasRootNode(BindingMessageInfo bmi, QName elName) {
         XMLBindingMessageFormat xmf = bmi.getExtensor(XMLBindingMessageFormat.class);
-        return xmf != null && xmf.getRootNode().equals(elName);
+        return bmi.getMessageParts().size() != 1 && xmf != null && xmf.getRootNode().equals(elName);
     }
 }