cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1227490 - in /cxf/trunk/rt/frontend/jaxws/src: main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java test/java/org/apache/cxf/jaxws/context/WebServiceContextImplTest.java
Date Thu, 05 Jan 2012 05:32:46 GMT
Author: ema
Date: Thu Jan  5 05:32:45 2012
New Revision: 1227490

URL: http://svn.apache.org/viewvc?rev=1227490&view=rev
Log:
[CXF-3989]:messageConetxt.setScope(MessageContext.HTTP_REQUEST_HEADERS, Scope.APPLICATION)
leads to java.lang.IllegalArgumentException

Modified:
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/context/WebServiceContextImplTest.java

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java?rev=1227490&r1=1227489&r2=1227490&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java
Thu Jan  5 05:32:45 2012
@@ -484,7 +484,7 @@ public class WrappedMessageContext imple
     }
 
     public final void setScope(String key, Scope arg1) {
-        if (!this.containsKey(key)) {
+        if (!this.containsKey(key) && !scopes.containsKey(key)) {
             throw new IllegalArgumentException("non-existant property-" + key + "is specified");
   
         }
         scopes.put(key, arg1);        

Modified: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/context/WebServiceContextImplTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/context/WebServiceContextImplTest.java?rev=1227490&r1=1227489&r2=1227490&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/context/WebServiceContextImplTest.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/context/WebServiceContextImplTest.java
Thu Jan  5 05:32:45 2012
@@ -21,7 +21,13 @@ package org.apache.cxf.jaxws.context;
 
 
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
 
 import org.apache.cxf.message.MessageImpl;
 import org.junit.After;
@@ -71,5 +77,19 @@ public class WebServiceContextImplTest e
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
-    } 
+    }
+    
+    // CXF-3989
+    @Test
+    @SuppressWarnings("unchecked")
+    public void testSetHttpRequestHeadersScope() {
+        MessageImpl msg = new MessageImpl();
+        MessageContext context = new WrappedMessageContext(msg);
+        Map headers = new HashMap<String, List<String>>();
+        List<String> values = new ArrayList<String>();
+        values.add("Value1");
+        headers.put("Header1", values);
+        context.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
+        context.setScope(MessageContext.HTTP_REQUEST_HEADERS, Scope.APPLICATION);
+    }
 }



Mime
View raw message