Skip to content
Permalink
Browse files

[CXF-7832]WrappedMessageContext containsKey not consistent with get/put

(cherry picked from commit 01ec97b)
  • Loading branch information...
ffang committed Sep 6, 2018
1 parent 93be601 commit 02f5a5bfbd60740b15824c824d10285f440c281d
@@ -193,7 +193,8 @@ public void clear() {
}

public final boolean containsKey(Object key) {
return message.containsKey(mapKey((String)key));
return message.containsKey(mapKey((String)key))
|| get(key) != null;
}

public final boolean containsValue(Object value) {
@@ -20,6 +20,7 @@
package org.apache.cxf.jaxws.context;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

@@ -81,4 +82,18 @@ public void testPutAndGetJaxwsAttachments() throws Exception {
}
}
}


@Test
public void testContainsKey() throws Exception {
WrappedMessageContext context =
new WrappedMessageContext(new HashMap<String, Object>(), null, Scope.APPLICATION);

Map<String, List<String>> headers = new HashMap<>();
context.put(MessageContext.HTTP_REQUEST_HEADERS, headers);

assertNotNull(context.get(MessageContext.HTTP_REQUEST_HEADERS));

assertTrue(context.containsKey(MessageContext.HTTP_REQUEST_HEADERS));
}
}

0 comments on commit 02f5a5b

Please sign in to comment.
You can’t perform that action at this time.