You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ro...@apache.org on 2007/06/29 17:30:06 UTC

svn commit: r551926 - in /webservices/axis2/trunk/java/modules/jaxws: src/org/apache/axis2/jaxws/core/MEPContext.java test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java

Author: rott
Date: Fri Jun 29 08:30:05 2007
New Revision: 551926

URL: http://svn.apache.org/viewvc?view=rev&rev=551926
Log:
Change MEPContext to use HashMap instead of Properties internally.  Properties class does not allow null values, HashMap does.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MEPContext.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MEPContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MEPContext.java?view=diff&rev=551926&r1=551925&r2=551926
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MEPContext.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MEPContext.java Fri Jun 29 08:30:05 2007
@@ -23,7 +23,6 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Properties;
 import java.util.Set;
 
 /**
@@ -138,7 +137,9 @@
             }
             return;
         }
-        // yes, clear both
+        // TODO: REVIEW
+        // I don't think this will work if the message contexts have a copy
+        // of the map
         if (responseMC != null) {
             responseMC.getProperties().clear();
         }
@@ -177,7 +178,7 @@
         if (isApplicationAccessLocked()) {
             return new ReadOnlySet(getApplicationScopedProperties().entrySet());
         }
-        Properties tempProps = new Properties();
+        HashMap tempProps = new HashMap();
         tempProps.putAll(requestMC.getProperties());
         if (responseMC != null) {
             tempProps.putAll(responseMC.getProperties());
@@ -185,16 +186,17 @@
         return new ReadOnlySet(tempProps.entrySet());
     }
 
-    public Object get(Object key) {
+    public Object get(Object keyObject) {
+        String key = (String) keyObject;
         if (responseMC != null) {
-            if (responseMC.getProperties().get(key) != null) {
+            if (responseMC.getProperty(key) != null) {
                 if ((getScope((String)key) == Scope.APPLICATION) || (!isApplicationAccessLocked())) {
-                    return responseMC.getProperties().get(key);
+                    return responseMC.getProperty(key);
                 }
             }
         }
         if ((getScope((String)key) == Scope.APPLICATION) || (!isApplicationAccessLocked())) {
-            return requestMC.getProperties().get(key);
+            return requestMC.getProperty(key);
         }
         return null;
     }
@@ -213,7 +215,7 @@
         if (isApplicationAccessLocked()) {
             return new ReadOnlySet(getApplicationScopedProperties().keySet());
         }
-        Properties tempProps = new Properties();
+        HashMap tempProps = new HashMap();
         tempProps.putAll(requestMC.getProperties());
         if (responseMC != null) {
             tempProps.putAll(responseMC.getProperties());
@@ -279,7 +281,10 @@
         if (isApplicationAccessLocked()) {
             return getApplicationScopedProperties().size();
         }
-        Properties tempProps = new Properties();
+        
+        // The properties must be combined together because some
+        // keys may be the same on the request and the response.
+        HashMap tempProps = new HashMap();
         tempProps.putAll(requestMC.getProperties());
         if (responseMC != null) {
             tempProps.putAll(responseMC.getProperties());
@@ -291,7 +296,7 @@
         if (isApplicationAccessLocked()) {
             return new ReadOnlyCollection(getApplicationScopedProperties().values());
         }
-        Properties tempProps = new Properties();
+        HashMap tempProps = new HashMap();
         tempProps.putAll(requestMC.getProperties());
         if (responseMC != null) {
             tempProps.putAll(responseMC.getProperties());

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java?view=diff&rev=551926&r1=551925&r2=551926
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java Fri Jun 29 08:30:05 2007
@@ -35,6 +35,11 @@
         Boolean outbound = (Boolean)messagecontext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
         if (!outbound) {  // inbound response on the client
 
+            // previously caused a NPE due to internal Properties.putAll(map);
+            // where 'map' had a key/value pair with null value.  So, internally
+            // we now use HashMap instead of Properties.
+            int size = messagecontext.size();
+            
             /*
              * These props were set on the outbound flow.  Inbound flow handlers
              * should have access to them.



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org