cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r692477 - in /cxf/branches/2.0.x-fixes: ./ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ systests/src/test/java/org/apache/cxf/systest/outofband/header/
Date Fri, 05 Sep 2008 16:30:02 GMT
Author: dkulp
Date: Fri Sep  5 09:30:01 2008
New Revision: 692477

URL: http://svn.apache.org/viewvc?rev=692477&view=rev
Log:
Merged revisions 692162 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.1.x-fixes

................
  r692162 | dkulp | 2008-09-04 12:59:16 -0400 (Thu, 04 Sep 2008) | 10 lines
  
  Merged revisions 692116 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r692116 | dkulp | 2008-09-04 11:46:34 -0400 (Thu, 04 Sep 2008) | 3 lines
    
    Don't hold onto the header objects (allow them to be gc'd sooner)
    Update error message to be a bit more descriptive
  ........
................

Modified:
    cxf/branches/2.0.x-fixes/   (props changed)
    cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Messages.properties
    cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
    cxf/branches/2.0.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/MustUnderstandInterceptorTest.java
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java

Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Sep  5 09:30:01 2008
@@ -1,3 +1,3 @@
-/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491,691711,691715,691745,692468
-/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488,691602,691706,691728,692466
+/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491,691711,691715,691745,692162,692468
+/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488,691602,691706,691728,692116,692466
 /incubator/cxf/trunk:434594-651668

Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Sep  5 09:30:01 2008
@@ -1 +1 @@
-/cxf/branches/2.1.x-fixes:1-686313,686315-686332,686334-686346,686348-686828,687097,687464-687465,689109,689112,689122,690841,691316,691357,691491,691711,691715,691745,692344,692468
+/cxf/branches/2.1.x-fixes:1-686313,686315-686332,686334-686346,686348-686828,687097,687464-687465,689109,689112,689122,690841,691316,691357,691491,691711,691715,691745,692162,692344,692468

Modified: cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Messages.properties?rev=692477&r1=692476&r2=692477&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Messages.properties
(original)
+++ cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Messages.properties
Fri Sep  5 09:30:01 2008
@@ -21,7 +21,7 @@
 
 XML_STREAM_EXC=Error reading XMLStreamReader.
 XML_WRITE_EXC=Error writing to XMLStreamWriter.
-MUST_UNDERSTAND=Can not understand QNames: {0}
+MUST_UNDERSTAND=MustUnderstand headers: {0} are not understood.
 PARSER_EXC=Could not create DOM DocumentBuilder.
 NO_OPERATION=No such operation: {0}
 ATTACHMENT_IO=Attachment IO Exception: {0}

Modified: cxf/branches/2.0.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.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java?rev=692477&r1=692476&r2=692477&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
Fri Sep  5 09:30:01 2008
@@ -59,7 +59,7 @@
         SoapVersion soapVersion = soapMessage.getVersion();              
         Set<Header> mustUnderstandHeaders = new HashSet<Header>();
         Set<URI> serviceRoles = new HashSet<URI>();
-        Set<Header> notUnderstandHeaders = new HashSet<Header>();
+        Set<QName> notUnderstandHeaders = new HashSet<QName>();
         Set<Header> ultimateReceiverHeaders = new HashSet<Header>();
         Set<QName> mustUnderstandQNames = new HashSet<QName>();
 
@@ -67,27 +67,15 @@
                                    serviceRoles, ultimateReceiverHeaders);
         initServiceSideInfo(mustUnderstandQNames, soapMessage, serviceRoles);
         
-        if (!checkUnderstand(mustUnderstandHeaders, mustUnderstandQNames,
-                             notUnderstandHeaders)) {
-            StringBuffer sb = new StringBuffer(300);
-            boolean first = true;
-            for (Header head : notUnderstandHeaders) {
-                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());
-            }
+        checkUnderstand(mustUnderstandHeaders, mustUnderstandQNames,
+                             notUnderstandHeaders);
+        if (!notUnderstandHeaders.isEmpty()) {
+            throw new SoapFault(new Message("MUST_UNDERSTAND", BUNDLE, notUnderstandHeaders),
+                            soapVersion.getMustUnderstand());
         }
         if (!ultimateReceiverHeaders.isEmpty()) {
             soapMessage.getInterceptorChain()
-                .add(new UltimateReceiverMustUnderstandInterceptor(ultimateReceiverHeaders,
-                                                                   mustUnderstandQNames));
+                .add(new UltimateReceiverMustUnderstandInterceptor(mustUnderstandQNames));
         }
     }
 
@@ -143,20 +131,16 @@
         }
     }
 
-    private boolean checkUnderstand(Set<Header> mustUnderstandHeaders,
+    private void checkUnderstand(Set<Header> mustUnderstandHeaders,
                                     Set<QName> mustUnderstandQNames,
-                                    Set<Header> notUnderstandHeaders) {
+                                    Set<QName> notUnderstandHeaders) {
 
         for (Header header : mustUnderstandHeaders) {
             QName qname = header.getName();
             if (!mustUnderstandQNames.contains(qname)) {
-                notUnderstandHeaders.add(header);
+                notUnderstandHeaders.add(header.getName());
             }
         }
-        if (notUnderstandHeaders.size() > 0) {
-            return false;
-        }
-        return true;
     }
     
     
@@ -165,42 +149,33 @@
      * 
      */
     private class UltimateReceiverMustUnderstandInterceptor extends AbstractSoapInterceptor
{
-        Set<Header> ultimateReceiverHeaders;
         Set<QName> knownHeaders;
-        public UltimateReceiverMustUnderstandInterceptor(Set<Header> ult,
-                                                         Set<QName> knownHeaders) {
+        public UltimateReceiverMustUnderstandInterceptor(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>();
+            Set<QName> notFound = new HashSet<QName>();
             List<Header> heads = soapMessage.getHeaders();
-            for (Header header : ultimateReceiverHeaders) {
-                if (heads.contains(header)
+            
+            for (Header header : heads) {
+                if (header instanceof SoapHeader
+                    && ((SoapHeader)header).isMustUnderstand()
                     && header.getDirection() == Header.Direction.DIRECTION_IN
-                    && !knownHeaders.contains(header.getName())) {
-                    notFound.add(header);
+                    && !knownHeaders.contains(header.getName())
+                    && (StringUtils.isEmpty(((SoapHeader)header).getActor())
+                        || soapVersion.getUltimateReceiverRole()
+                            .equals(((SoapHeader)header).getActor()))) {
+                    
+                    notFound.add(header.getName());
                 }
             }
             
             
             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());
-                }
+                throw new SoapFault(new Message("MUST_UNDERSTAND", BUNDLE, notFound),
+                                soapVersion.getMustUnderstand());
             }            
         }
 

Modified: cxf/branches/2.0.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/MustUnderstandInterceptorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/MustUnderstandInterceptorTest.java?rev=692477&r1=692476&r2=692477&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/MustUnderstandInterceptorTest.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/MustUnderstandInterceptorTest.java
Fri Sep  5 09:30:01 2008
@@ -99,7 +99,7 @@
             fail("InBound Exception Missing! Exception should be Can't understands QNames:
" + PASSENGER);
         } else {
             assertEquals(soapMessage.getVersion().getMustUnderstand(), ie.getFaultCode());
-            assertEquals("Can not understand QNames: " + PASSENGER, ie.getMessage().toString());
+            assertTrue(ie.getMessage().toString().contains(PASSENGER.toString()));
         }
     }
 

Modified: cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java?rev=692477&r1=692476&r2=692477&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java
(original)
+++ cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java
Fri Sep  5 09:30:01 2008
@@ -191,7 +191,7 @@
             putLastTradedPrice.sayHi(holder);
             fail("mustUnderstand header should not have been processed");
         } catch (Exception ex) {
-            assertTrue(ex.getMessage().contains("Can not understand"));
+            assertTrue(ex.getMessage(), ex.getMessage().contains("MustUnderstand"));
         }
     }
 }



Mime
View raw message