cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r691715 - in /cxf/branches/2.1.x-fixes: ./ common/common/src/main/java/org/apache/cxf/staxutils/ distribution/bundle/all/ distribution/bundle/jaxrs/ distribution/bundle/minimal/ parent/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/...
Date Wed, 03 Sep 2008 18:23:06 GMT
Author: dkulp
Date: Wed Sep  3 11:23:05 2008
New Revision: 691715

URL: http://svn.apache.org/viewvc?rev=691715&view=rev
Log:
Merged revisions 691706 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r691706 | dkulp | 2008-09-03 14:13:05 -0400 (Wed, 03 Sep 2008) | 5 lines
  
  [CXF-1778, CXF-1781] Fix memory leak with ws-addressing if server is down
  Make sure we process the mustUnderstand headers
  If List<Header> contains SoapHeader objects, make sure we write the mustUnderstand/actor
stuff out
  Remove dependency on stax-utils
........

Added:
    cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/DelegatingXMLStreamWriter.java
      - copied unchanged from r691706, cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/DelegatingXMLStreamWriter.java
Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/distribution/bundle/all/pom.xml
    cxf/branches/2.1.x-fixes/distribution/bundle/jaxrs/pom.xml
    cxf/branches/2.1.x-fixes/distribution/bundle/minimal/pom.xml
    cxf/branches/2.1.x-fixes/parent/pom.xml
    cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
    cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
    cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
    cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/TestBase.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/pom.xml
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/xml/SourceType.java
    cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
    cxf/branches/2.1.x-fixes/rt/javascript/pom.xml
    cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHdrServiceImpl.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep  3 11:23:05 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691355,691488,691602,691646
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691355,691488,691602,691646,691706

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.1.x-fixes/distribution/bundle/all/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/distribution/bundle/all/pom.xml?rev=691715&r1=691714&r2=691715&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/distribution/bundle/all/pom.xml (original)
+++ cxf/branches/2.1.x-fixes/distribution/bundle/all/pom.xml Wed Sep  3 11:23:05 2008
@@ -261,7 +261,6 @@
                             antlr*;resolution:=optional,
                             com.ibm*;resolution:=optional,
                             com.sun*;resolution:=optional,
-                            javanet.staxutils*;resolution:=optional,
                             javax.jms*;resolution:=optional,
                             javax.ws.rs*;resolution:=optional,
                             repackage;resolution:=optional,

Modified: cxf/branches/2.1.x-fixes/distribution/bundle/jaxrs/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/distribution/bundle/jaxrs/pom.xml?rev=691715&r1=691714&r2=691715&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/distribution/bundle/jaxrs/pom.xml (original)
+++ cxf/branches/2.1.x-fixes/distribution/bundle/jaxrs/pom.xml Wed Sep  3 11:23:05 2008
@@ -116,7 +116,6 @@
                             antlr*;resolution:=optional,
                             com.ibm*;resolution:=optional,
                             com.sun*;resolution:=optional,
-                            javanet.staxutils*;resolution:=optional,
                             javax.jms*;resolution:=optional,
                             javax.ws.rs*;resolution:=optional,
                             repackage;resolution:=optional,

Modified: cxf/branches/2.1.x-fixes/distribution/bundle/minimal/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/distribution/bundle/minimal/pom.xml?rev=691715&r1=691714&r2=691715&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/distribution/bundle/minimal/pom.xml (original)
+++ cxf/branches/2.1.x-fixes/distribution/bundle/minimal/pom.xml Wed Sep  3 11:23:05 2008
@@ -150,7 +150,6 @@
                             antlr*;resolution:=optional,
                             com.ibm*;resolution:=optional,
                             com.sun*;resolution:=optional,
-                            javanet.staxutils*;resolution:=optional,
                             javax.jms*;resolution:=optional,
                             javax.ws.rs*;resolution:=optional,
                             repackage;resolution:=optional,

Modified: cxf/branches/2.1.x-fixes/parent/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/parent/pom.xml?rev=691715&r1=691714&r2=691715&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/parent/pom.xml (original)
+++ cxf/branches/2.1.x-fixes/parent/pom.xml Wed Sep  3 11:23:05 2008
@@ -497,18 +497,6 @@
                     </exclusion>
                 </exclusions>
             </dependency>
-			<dependency>
-				<groupId>net.java.dev.stax-utils</groupId>
-				<artifactId>stax-utils</artifactId>
-				<version>20060502</version>
-				<exclusions>
-					<exclusion>
-						<groupId>com.bea.xml</groupId>
-						<artifactId>jsr173-ri</artifactId>
-					</exclusion>
-				</exclusions>
-			</dependency>
-
             <dependency>
                 <groupId>jaxen</groupId>
                 <artifactId>jaxen</artifactId>

Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java?rev=691715&r1=691714&r2=691715&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
Wed Sep  3 11:23:05 2008
@@ -21,6 +21,7 @@
 
 import java.net.URI;
 import java.util.HashSet;
+import java.util.List;
 import java.util.ResourceBundle;
 import java.util.Set;
 import java.util.logging.Logger;
@@ -34,11 +35,15 @@
 import org.apache.cxf.binding.soap.SoapVersion;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.headers.Header;
+import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.phase.Phase;
 
 public class MustUnderstandInterceptor extends AbstractSoapInterceptor {
+
+
     private static final Logger LOG = LogUtils.getL7dLogger(MustUnderstandInterceptor.class);
 
     private static final ResourceBundle BUNDLE = LOG.getResourceBundle();
@@ -54,22 +59,35 @@
         SoapVersion soapVersion = soapMessage.getVersion();              
         Set<Header> mustUnderstandHeaders = new HashSet<Header>();
         Set<URI> serviceRoles = new HashSet<URI>();
-        Set<QName> notUnderstandQNames = new HashSet<QName>();
+        Set<Header> notUnderstandHeaders = new HashSet<Header>();
+        Set<Header> ultimateReceiverHeaders = new HashSet<Header>();
         Set<QName> mustUnderstandQNames = new HashSet<QName>();
 
-        buildMustUnderstandHeaders(mustUnderstandHeaders, soapMessage, serviceRoles);
+        buildMustUnderstandHeaders(mustUnderstandHeaders, soapMessage,
+                                   serviceRoles, ultimateReceiverHeaders);
         initServiceSideInfo(mustUnderstandQNames, soapMessage, serviceRoles);
         
-        if (!checkUnderstand(mustUnderstandHeaders, mustUnderstandQNames, notUnderstandQNames))
{
+        if (!checkUnderstand(mustUnderstandHeaders, mustUnderstandQNames,
+                             notUnderstandHeaders)) {
             StringBuffer sb = new StringBuffer(300);
-            int pos = 0;
-            for (QName qname : notUnderstandQNames) {
-                pos = pos + qname.toString().length() + 2;
-                sb.append(qname.toString() + ", ");
+            boolean first = true;
+            for (Header head : notUnderstandHeaders) {
+                if (first) {
+                    first = false;
+                } else {
+                    sb.append(", ");
+                }
+                sb.append(head.getName().toString());
             }
-            sb.delete(pos - 2, pos);
-            throw new SoapFault(new Message("MUST_UNDERSTAND", BUNDLE, sb.toString()),
+            if (sb.length() > 0) {
+                throw new SoapFault(new Message("MUST_UNDERSTAND", BUNDLE, sb.toString()),
                                 soapVersion.getMustUnderstand());
+            }
+        }
+        if (!ultimateReceiverHeaders.isEmpty()) {
+            soapMessage.getInterceptorChain()
+                .add(new UltimateReceiverMustUnderstandInterceptor(ultimateReceiverHeaders,
+                                                                   mustUnderstandQNames));
         }
     }
 
@@ -98,15 +116,17 @@
 
     private void buildMustUnderstandHeaders(Set<Header> mustUnderstandHeaders,
                                             SoapMessage soapMessage,
-                                            Set<URI> serviceRoles) {
+                                            Set<URI> serviceRoles,
+                                            Set<Header> ultimateReceiverHeaders) {
         for (Header header : soapMessage.getHeaders()) {
             if (header instanceof SoapHeader && ((SoapHeader)header).isMustUnderstand())
{
                 String role = ((SoapHeader)header).getActor();
-                if (role != null) {
+                if (!StringUtils.isEmpty(role)) {
                     role = role.trim();
-                    if (role.equals(soapMessage.getVersion().getNextRole())
-                                    || role.equals(soapMessage.getVersion().getUltimateReceiverRole()))
{
+                    if (role.equals(soapMessage.getVersion().getNextRole())) {
                         mustUnderstandHeaders.add(header);
+                    } else if (role.equals(soapMessage.getVersion().getUltimateReceiverRole()))
{
+                        ultimateReceiverHeaders.add(header);                        
                     } else {
                         for (URI roleFromBinding : serviceRoles) {
                             if (role.equals(roleFromBinding.toString())) {
@@ -117,7 +137,7 @@
                 } else {
                     // if role omitted, the soap node is ultimate receiver,
                     // needs to understand
-                    mustUnderstandHeaders.add(header);
+                    ultimateReceiverHeaders.add(header);
                 }
             }
         }
@@ -125,17 +145,64 @@
 
     private boolean checkUnderstand(Set<Header> mustUnderstandHeaders,
                                     Set<QName> mustUnderstandQNames,
-                                    Set<QName> notUnderstandQNames) {
+                                    Set<Header> notUnderstandHeaders) {
 
         for (Header header : mustUnderstandHeaders) {
             QName qname = header.getName();
             if (!mustUnderstandQNames.contains(qname)) {
-                notUnderstandQNames.add(qname);
+                notUnderstandHeaders.add(header);
             }
         }
-        if (notUnderstandQNames.size() > 0) {
+        if (notUnderstandHeaders.size() > 0) {
             return false;
         }
         return true;
     }
+    
+    
+    
+    /**
+     * 
+     */
+    private class UltimateReceiverMustUnderstandInterceptor extends AbstractSoapInterceptor
{
+        Set<Header> ultimateReceiverHeaders;
+        Set<QName> knownHeaders;
+        public UltimateReceiverMustUnderstandInterceptor(Set<Header> ult,
+                                                         Set<QName> knownHeaders) {
+            super(Phase.INVOKE);
+            this.knownHeaders = knownHeaders;
+            ultimateReceiverHeaders = ult;
+        }
+        public void handleMessage(SoapMessage soapMessage) throws Fault {
+            SoapVersion soapVersion = soapMessage.getVersion();
+            Set<Header> notFound = new HashSet<Header>();
+            List<Header> heads = soapMessage.getHeaders();
+            for (Header header : ultimateReceiverHeaders) {
+                if (heads.contains(header)
+                    && header.getDirection() == Header.Direction.DIRECTION_IN
+                    && !knownHeaders.contains(header.getName())) {
+                    notFound.add(header);
+                }
+            }
+            
+            
+            if (!notFound.isEmpty()) {
+                StringBuffer sb = new StringBuffer(300);
+                boolean first = true;
+                for (Header head : notFound) {
+                    if (first) {
+                        first = false;
+                    } else {
+                        sb.append(", ");
+                    }
+                    sb.append(head.getName().toString());
+                }
+                if (sb.length() > 0) {
+                    throw new SoapFault(new Message("MUST_UNDERSTAND", BUNDLE, sb.toString()),
+                                    soapVersion.getMustUnderstand());
+                }
+            }            
+        }
+
+    }
 }

Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java?rev=691715&r1=691714&r2=691715&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
Wed Sep  3 11:23:05 2008
@@ -43,6 +43,7 @@
 import org.apache.cxf.binding.soap.SoapVersionFactory;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.headers.HeaderManager;
 import org.apache.cxf.headers.HeaderProcessor;
@@ -160,8 +161,10 @@
                                                           soapVersion.getAttrNameMustUnderstand());
                             String act = hel.getAttributeNS(soapVersion.getNamespace(),
                                                             soapVersion.getAttrNameRole());
-                            
-                            shead.setActor(act);
+
+                            if (!StringUtils.isEmpty(act)) {
+                                shead.setActor(act);
+                            }
                             shead.setMustUnderstand(Boolean.valueOf(mu) || "1".equals(mu));
                             //mark header as inbound header.(for distinguishing between the
 direction to 
                             //avoid piggybacking of headers from request->server->response.

Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java?rev=691715&r1=691714&r2=691715&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
Wed Sep  3 11:23:05 2008
@@ -31,10 +31,12 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapHeader;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.SoapVersion;
 import org.apache.cxf.binding.soap.model.SoapHeaderInfo;
 import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.databinding.DataWriter;
 import org.apache.cxf.headers.Header;
@@ -52,6 +54,7 @@
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.ServiceModelUtil;
+import org.apache.cxf.staxutils.DelegatingXMLStreamWriter;
 import org.apache.cxf.staxutils.StaxUtils;
 
 public class SoapOutInterceptor extends AbstractSoapInterceptor {
@@ -87,8 +90,8 @@
         message.getInterceptorChain().add(new SoapOutEndingInterceptor());
     }
     
-    private void writeSoapEnvelopeStart(SoapMessage message) {
-        SoapVersion soapVersion = message.getVersion();
+    private void writeSoapEnvelopeStart(final SoapMessage message) {
+        final SoapVersion soapVersion = message.getVersion();
         try {            
             XMLStreamWriter xtw = message.getContent(XMLStreamWriter.class);
             xtw.setPrefix(soapVersion.getPrefix(), soapVersion.getNamespace());
@@ -105,6 +108,11 @@
                                       soapVersion.getNamespace());   
                 List<Header> hdrList = message.getHeaders();
                 for (Header header : hdrList) {
+                    XMLStreamWriter writer = xtw;
+                    if (header instanceof SoapHeader) {
+                        SoapHeader soapHeader = (SoapHeader)header;
+                        writer = new SOAPHeaderWriter(xtw, soapHeader, soapVersion);
+                    }
                     DataBinding b = header.getDataBinding();
                     if (b == null) {
                         HeaderProcessor hp = bus.getExtension(HeaderManager.class)
@@ -114,11 +122,13 @@
                         }
                     }
                     if (b != null) {
+                        MessagePartInfo part = new MessagePartInfo(header.getName(), null);
+                        part.setConcreteName(header.getName());
                         b.createWriter(XMLStreamWriter.class)
-                            .write(header.getObject(), xtw);
+                            .write(header.getObject(), part, writer);
                     } else {
                         Element node = (Element)header.getObject();
-                        StaxUtils.copy(node, xtw);
+                        StaxUtils.copy(node, writer);
                     }
                 }
             }
@@ -249,6 +259,71 @@
                                     soapVersion.getSender());
             }
         }
-
-    }    
+    }
+    
+    public static class SOAPHeaderWriter extends DelegatingXMLStreamWriter {
+        final SoapHeader soapHeader;
+        final SoapVersion soapVersion;
+        boolean firstDone;
+        
+        public SOAPHeaderWriter(XMLStreamWriter writer,
+                                SoapHeader header,
+                                SoapVersion version) {
+            super(writer);
+            soapHeader = header;
+            soapVersion = version;
+        }
+        
+        public void writeAttribute(String prefix, String uri, String local, String value)
+            throws XMLStreamException {
+            if (soapVersion.getNamespace().equals(uri)
+                && (local.equals(soapVersion.getAttrNameMustUnderstand())
+                    || local.equals(soapVersion.getAttrNameRole()))) {
+                return;
+            }
+            super.writeAttribute(prefix, uri, local, value);
+        }
+        public void writeAttribute(String uri, String local, String value) throws XMLStreamException
{
+            if (soapVersion.getNamespace().equals(uri)
+                && (local.equals(soapVersion.getAttrNameMustUnderstand())
+                    || local.equals(soapVersion.getAttrNameRole()))) {
+                return;
+            }
+            super.writeAttribute(uri, local, value);
+        }
+        
+        private void writeSoapAttributes() throws XMLStreamException {
+            if (!firstDone) {
+                firstDone = true;
+                if (!StringUtils.isEmpty(soapHeader.getActor())) {
+                    super.writeAttribute(soapVersion.getPrefix(),
+                                   soapVersion.getNamespace(),
+                                   soapVersion.getAttrNameRole(),
+                                   soapHeader.getActor());
+                }
+                if (soapHeader.isMustUnderstand()) {
+                    super.writeAttribute(soapVersion.getPrefix(),
+                                   soapVersion.getNamespace(),
+                                   soapVersion.getAttrNameMustUnderstand(),
+                                   "true");                                        
+                }
+            }
+        }
+        public void writeStartElement(String arg0, String arg1, String arg2)
+            throws XMLStreamException {
+            super.writeStartElement(arg0, arg1, arg2);
+            writeSoapAttributes();
+        }
+        public void writeStartElement(String arg0, String arg1)
+            throws XMLStreamException {
+            super.writeStartElement(arg0, arg1);
+            writeSoapAttributes();
+        }
+        public void writeStartElement(String arg0) throws XMLStreamException {
+            super.writeStartElement(arg0);
+            writeSoapAttributes();
+        }
+        
+        
+    };
 }

Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/TestBase.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/TestBase.java?rev=691715&r1=691714&r2=691715&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/TestBase.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/TestBase.java
Wed Sep  3 11:23:05 2008
@@ -69,6 +69,7 @@
         phases.add(phase2);
         phases.add(phase3);
         phases.add(phase4);
+        phases.add(new Phase(Phase.INVOKE, 5));
         chain = new PhaseInterceptorChain(phases);
 
         soapMessage = TestUtil.createEmptySoapMessage(Soap11.getInstance(), chain);

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/pom.xml?rev=691715&r1=691714&r2=691715&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/pom.xml (original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/pom.xml Wed Sep  3 11:23:05 2008
@@ -84,17 +84,6 @@
             <version>${jdom.version}</version>
         </dependency>
         <dependency>
-            <groupId>net.java.dev.stax-utils</groupId>
-            <artifactId>stax-utils</artifactId>
-            <version>20060502</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>com.bea.xml</groupId>
-                    <artifactId>jsr173-ri</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
             <groupId>jaxen</groupId>
             <artifactId>jaxen</artifactId>
         </dependency>

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/xml/SourceType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/xml/SourceType.java?rev=691715&r1=691714&r2=691715&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/xml/SourceType.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/xml/SourceType.java
Wed Sep  3 11:23:05 2008
@@ -24,8 +24,6 @@
 import javax.xml.stream.XMLStreamWriter;
 import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stream.StreamSource;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -34,8 +32,6 @@
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLReaderFactory;
 
-import javanet.staxutils.ContentHandlerToXMLStreamWriter;
-
 import org.apache.cxf.aegis.Context;
 import org.apache.cxf.aegis.DatabindingException;
 import org.apache.cxf.aegis.type.Type;
@@ -101,24 +97,8 @@
             }
 
             StaxUtils.writeElement(element, writer, false);
-        } else if (object instanceof SAXSource) {
-            SAXSource source = (SAXSource)object;
-
-            try {
-                XMLReader xmlReader = source.getXMLReader();
-                if (xmlReader == null) {
-                    xmlReader = createXMLReader();
-                }
-
-                xmlReader.setContentHandler(new FilteringContentHandlerToXMLStreamWriter(writer));
-
-                xmlReader.parse(source.getInputSource());
-            } catch (Exception e) {
-                throw new DatabindingException("Could not send xml.", e);
-            }
-        } else if (object instanceof StreamSource) {
-            StreamSource ss = (StreamSource)object;
-            XMLStreamReader reader = StaxUtils.createXMLStreamReader(ss.getInputStream(),
null);
+        } else {
+            XMLStreamReader reader = StaxUtils.createXMLStreamReader((Source)object);
             StaxUtils.copy(reader, writer);
         }
     }
@@ -136,17 +116,4 @@
         }
     }
 
-    class FilteringContentHandlerToXMLStreamWriter extends ContentHandlerToXMLStreamWriter
{
-        public FilteringContentHandlerToXMLStreamWriter(XMLStreamWriter xmlStreamWriter)
{
-            super(xmlStreamWriter);
-        }
-
-        @Override
-        public void startDocument() throws SAXException {
-        }
-
-        @Override
-        public void endDocument() throws SAXException {
-        }
-    }
 }

Modified: cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java?rev=691715&r1=691714&r2=691715&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
Wed Sep  3 11:23:05 2008
@@ -158,6 +158,8 @@
                            && part.getTypeQName().getLocalPart().equals("hexBinary"))
{
                     mObj = new HexBinaryAdapter().marshal((byte[])mObj);
                     writeObject(marshaller, source, new JAXBElement(elName, String.class,
mObj));
+                } else if (mObj instanceof JAXBElement) {
+                    writeObject(marshaller, source, mObj);
                 } else {
                     writeObject(marshaller, source, new JAXBElement(elName, cls, mObj));
                 }

Modified: cxf/branches/2.1.x-fixes/rt/javascript/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/pom.xml?rev=691715&r1=691714&r2=691715&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/javascript/pom.xml (original)
+++ cxf/branches/2.1.x-fixes/rt/javascript/pom.xml Wed Sep  3 11:23:05 2008
@@ -69,10 +69,6 @@
             <version>${jdom.version}</version>
         </dependency>
         <dependency>
-            <groupId>net.java.dev.stax-utils</groupId>
-            <artifactId>stax-utils</artifactId>
-        </dependency>
-        <dependency>
             <groupId>jaxen</groupId>
             <artifactId>jaxen</artifactId>
         </dependency>

Modified: cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java?rev=691715&r1=691714&r2=691715&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
Wed Sep  3 11:23:05 2008
@@ -116,6 +116,13 @@
      * @param message the messsage message
      */
     public void handleFault(SoapMessage message) {
+        AddressingProperties maps = ContextUtils.retrieveMAPs(message, false, true, false);
+        if (ContextUtils.isRequestor(message) 
+            && !message.getExchange().isOneWay()
+            && maps != null) {
+            //fault occured trying to sent the message, remove it
+            uncorrelatedExchanges.remove(maps.getMessageID().getValue());
+        }
     }
 
     /**

Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHdrServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHdrServiceImpl.java?rev=691715&r1=691714&r2=691715&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHdrServiceImpl.java
(original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHdrServiceImpl.java
Wed Sep  3 11:23:05 2008
@@ -104,35 +104,36 @@
         MessageContext ctx = context == null ? null : context.getMessageContext();
         if (ctx.containsKey(Header.HEADER_LIST)) {
             List oobHdr = (List) ctx.get(Header.HEADER_LIST);
-            
-            if (oobHdr instanceof List) {
-                Iterator iter = oobHdr.iterator();
-                while (iter.hasNext()) {
-                    Object hdr = iter.next();
-                    if (hdr instanceof Header && ((Header) hdr).getObject() instanceof
Node) {
-                        Header hdr1 = (Header) hdr;
-                        //System.out.println("Node conains : " + hdr1.getObject().toString());
-                        try {
-                            JAXBElement job = (JAXBElement) JAXBContext.newInstance(ObjectFactory.class)
-                                .createUnmarshaller()
-                                .unmarshal((Node) hdr1.getObject());
-                            OutofBandHeader ob = (OutofBandHeader) job.getValue();
-                            if ("testOobHeader".equals(ob.getName())
-                                && "testOobHeaderValue".equals(ob.getValue())
-                                && "testHdrAttribute".equals(ob.getHdrAttribute()))
{
+            Iterator iter = oobHdr.iterator();
+            while (iter.hasNext()) {
+                Object hdr = iter.next();
+                if (hdr instanceof Header && ((Header) hdr).getObject() instanceof
Node) {
+                    Header hdr1 = (Header) hdr;
+                    //System.out.println("Node conains : " + hdr1.getObject().toString());
+                    try {
+                        JAXBElement job = (JAXBElement) JAXBContext.newInstance(ObjectFactory.class)
+                            .createUnmarshaller()
+                            .unmarshal((Node) hdr1.getObject());
+                        OutofBandHeader ob = (OutofBandHeader) job.getValue();
+                        if ("testOobHeader".equals(ob.getName())
+                            && "testOobHeaderValue".equals(ob.getValue())) { 
+                            if ("testHdrAttribute".equals(ob.getHdrAttribute())) {
+                                success = true;
+                                iter.remove(); //mark it processed
+                            } else if ("dontProcess".equals(ob.getHdrAttribute())) {
+                                //we won't remove it so we won't let the runtime know
+                                //it's processed.   It SHOULD throw an exception 
+                                //saying the mustunderstand wasn't processed
                                 success = true;
-                            } else {
-                                throw new RuntimeException("test failed");
                             }
-                        } catch (JAXBException ex) {
-                            //
-                            ex.printStackTrace();
+                        } else {
+                            throw new RuntimeException("test failed");
                         }
+                    } catch (JAXBException ex) {
+                        //
+                        ex.printStackTrace();
                     }
                 }
-            } else {
-                throw new RuntimeException("Header should not be null"
-                                           + "and should be of type JAXBHeaderHolder");
             }
         } else {
             throw new RuntimeException("MessageContext is null or doesnot contain OOBHeaders");

Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java?rev=691715&r1=691714&r2=691715&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java
(original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java
Wed Sep  3 11:23:05 2008
@@ -38,6 +38,7 @@
 
 import org.apache.cxf.BusFactory;
 
+import org.apache.cxf.binding.soap.SoapHeader;
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.headers.Header;
 import org.apache.cxf.jaxb.JAXBDataBinding;
@@ -78,7 +79,7 @@
         assertTrue("server did not launch correctly", launchServer(Server.class, true));
     }
     
-    private void addOutOfBoundHeader(PutLastTradedPricePortType portType) {
+    private void addOutOfBoundHeader(PutLastTradedPricePortType portType, boolean invalid)
{
         InvocationHandler handler  = Proxy.getInvocationHandler(portType);
         BindingProvider  bp = null;
 
@@ -90,14 +91,13 @@
                 OutofBandHeader ob = new OutofBandHeader();
                 ob.setName("testOobHeader");
                 ob.setValue("testOobHeaderValue");
-                ob.setHdrAttribute("testHdrAttribute");
+                ob.setHdrAttribute(invalid ? "dontProcess" : "testHdrAttribute");
 
-                JAXBElement<OutofBandHeader> job = new JAXBElement<OutofBandHeader>(
-                        new QName(TEST_HDR_NS, TEST_HDR_REQUEST_ELEM), OutofBandHeader.class,
null, ob);
-                Header hdr = new Header(
+                SoapHeader hdr = new SoapHeader(
                         new QName(TEST_HDR_NS, TEST_HDR_REQUEST_ELEM), 
-                        job, 
+                        ob, 
                         new JAXBDataBinding(ob.getClass()));
+                hdr.setMustUnderstand(true);
 
                 List<Header> holder = new ArrayList<Header>();
                 holder.add(hdr);
@@ -182,10 +182,16 @@
         priceData.setTickerSymbol("CELTIX");
         Holder<TradePriceData> holder = new Holder<TradePriceData>(priceData);
         
-        addOutOfBoundHeader(putLastTradedPrice);
-        
+        addOutOfBoundHeader(putLastTradedPrice, false);
         putLastTradedPrice.sayHi(holder);
-        
         checkReturnedOOBHeader(putLastTradedPrice);
+        
+        addOutOfBoundHeader(putLastTradedPrice, true);
+        try {
+            putLastTradedPrice.sayHi(holder);
+            fail("mustUnderstand header should not have been processed");
+        } catch (Exception ex) {
+            assertTrue(ex.getMessage().contains("Can not understand"));
+        }
     }
 }



Mime
View raw message