activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1078312 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMapMessage.java
Date Sat, 05 Mar 2011 17:15:25 GMT
Author: tabish
Date: Sat Mar  5 17:15:25 2011
New Revision: 1078312

URL: http://svn.apache.org/viewvc?rev=1078312&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQ-3202

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMapMessage.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMapMessage.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMapMessage.java?rev=1078312&r1=1078311&r2=1078312&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMapMessage.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMapMessage.java
Sat Mar  5 17:15:25 2011
@@ -20,6 +20,7 @@ import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.ObjectStreamException;
 import java.io.OutputStream;
 import java.util.Collections;
 import java.util.Enumeration;
@@ -71,14 +72,14 @@ import org.apache.activemq.wireformat.Wi
  * <CODE> String</CODE> representation of the primitive.
  * <P>
  * A value written as the row type can be read as the column type. <p/>
- * 
+ *
  * <PRE>
  * | | boolean byte short char int long float double String byte[] |----------------------------------------------------------------------
  * |boolean | X X |byte | X X X X X |short | X X X X |char | X X |int | X X X |long | X X
|float | X X X |double | X X
  * |String | X X X X X X X X |byte[] | X |----------------------------------------------------------------------
  * &lt;p/&gt;
  * </PRE>
- * 
+ *
  * <p/>
  * <P>
  * Attempting to read a null value as a primitive type must be treated as
@@ -86,7 +87,7 @@ import org.apache.activemq.wireformat.Wi
  * conversion method with a null value. Since <code>char</code> does not
  * support a <code>String</code> conversion, attempting to read a null value
  * as a <code>char</code> must throw a <code>NullPointerException</code>.
- * 
+ *
  * @openwire:marshaller code="25"
  * @see javax.jms.Session#createMapMessage()
  * @see javax.jms.BytesMessage
@@ -101,6 +102,13 @@ public class ActiveMQMapMessage extends 
 
     protected transient Map<String, Object> map = new HashMap<String, Object>();
 
+    private Object readResolve() throws ObjectStreamException {
+        if(this.map == null) {
+            this.map = new HashMap<String, Object>();
+        }
+        return this;
+    }
+
     public Message copy() {
         ActiveMQMapMessage copy = new ActiveMQMapMessage();
         copy(copy);
@@ -145,7 +153,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Builds the message body from data
-     * 
+     *
      * @throws JMSException
      * @throws IOException
      */
@@ -189,7 +197,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Returns the <CODE>boolean</CODE> value with the specified name.
-     * 
+     *
      * @param name the name of the <CODE>boolean</CODE>
      * @return the <CODE>boolean</CODE> value with the specified name
      * @throws JMSException if the JMS provider fails to read the message due to
@@ -214,7 +222,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Returns the <CODE>byte</CODE> value with the specified name.
-     * 
+     *
      * @param name the name of the <CODE>byte</CODE>
      * @return the <CODE>byte</CODE> value with the specified name
      * @throws JMSException if the JMS provider fails to read the message due to
@@ -239,7 +247,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Returns the <CODE>short</CODE> value with the specified name.
-     * 
+     *
      * @param name the name of the <CODE>short</CODE>
      * @return the <CODE>short</CODE> value with the specified name
      * @throws JMSException if the JMS provider fails to read the message due to
@@ -267,7 +275,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Returns the Unicode character value with the specified name.
-     * 
+     *
      * @param name the name of the Unicode character
      * @return the Unicode character value with the specified name
      * @throws JMSException if the JMS provider fails to read the message due to
@@ -289,7 +297,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Returns the <CODE>int</CODE> value with the specified name.
-     * 
+     *
      * @param name the name of the <CODE>int</CODE>
      * @return the <CODE>int</CODE> value with the specified name
      * @throws JMSException if the JMS provider fails to read the message due to
@@ -320,7 +328,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Returns the <CODE>long</CODE> value with the specified name.
-     * 
+     *
      * @param name the name of the <CODE>long</CODE>
      * @return the <CODE>long</CODE> value with the specified name
      * @throws JMSException if the JMS provider fails to read the message due to
@@ -354,7 +362,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Returns the <CODE>float</CODE> value with the specified name.
-     * 
+     *
      * @param name the name of the <CODE>float</CODE>
      * @return the <CODE>float</CODE> value with the specified name
      * @throws JMSException if the JMS provider fails to read the message due to
@@ -379,7 +387,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Returns the <CODE>double</CODE> value with the specified name.
-     * 
+     *
      * @param name the name of the <CODE>double</CODE>
      * @return the <CODE>double</CODE> value with the specified name
      * @throws JMSException if the JMS provider fails to read the message due to
@@ -407,7 +415,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Returns the <CODE>String</CODE> value with the specified name.
-     * 
+     *
      * @param name the name of the <CODE>String</CODE>
      * @return the <CODE>String</CODE> value with the specified name; if there
      *         is no item by this name, a null value is returned
@@ -430,7 +438,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Returns the byte array value with the specified name.
-     * 
+     *
      * @param name the name of the byte array
      * @return a copy of the byte array value with the specified name; if there
      *         is no item by this name, a null value is returned.
@@ -458,7 +466,7 @@ public class ActiveMQMapMessage extends 
      * <P>
      * Note that byte values are returned as <CODE>byte[]</CODE>, not
      * <CODE>Byte[]</CODE>.
-     * 
+     *
      * @param name the name of the Java object
      * @return a copy of the Java object value with the specified name, in
      *         objectified format (for example, if the object was set as an
@@ -475,7 +483,7 @@ public class ActiveMQMapMessage extends 
     /**
      * Returns an <CODE>Enumeration</CODE> of all the names in the
      * <CODE>MapMessage</CODE> object.
-     * 
+     *
      * @return an enumeration of all the names in this <CODE>MapMessage</CODE>
      * @throws JMSException
      */
@@ -496,7 +504,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Sets a <CODE>boolean</CODE> value with the specified name into the Map.
-     * 
+     *
      * @param name the name of the <CODE>boolean</CODE>
      * @param value the <CODE>boolean</CODE> value to set in the Map
      * @throws JMSException if the JMS provider fails to write the message due
@@ -512,7 +520,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Sets a <CODE>byte</CODE> value with the specified name into the Map.
-     * 
+     *
      * @param name the name of the <CODE>byte</CODE>
      * @param value the <CODE>byte</CODE> value to set in the Map
      * @throws JMSException if the JMS provider fails to write the message due
@@ -528,7 +536,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Sets a <CODE>short</CODE> value with the specified name into the Map.
-     * 
+     *
      * @param name the name of the <CODE>short</CODE>
      * @param value the <CODE>short</CODE> value to set in the Map
      * @throws JMSException if the JMS provider fails to write the message due
@@ -544,7 +552,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Sets a Unicode character value with the specified name into the Map.
-     * 
+     *
      * @param name the name of the Unicode character
      * @param value the Unicode character value to set in the Map
      * @throws JMSException if the JMS provider fails to write the message due
@@ -560,7 +568,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Sets an <CODE>int</CODE> value with the specified name into the Map.
-     * 
+     *
      * @param name the name of the <CODE>int</CODE>
      * @param value the <CODE>int</CODE> value to set in the Map
      * @throws JMSException if the JMS provider fails to write the message due
@@ -576,7 +584,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Sets a <CODE>long</CODE> value with the specified name into the Map.
-     * 
+     *
      * @param name the name of the <CODE>long</CODE>
      * @param value the <CODE>long</CODE> value to set in the Map
      * @throws JMSException if the JMS provider fails to write the message due
@@ -592,7 +600,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Sets a <CODE>float</CODE> value with the specified name into the Map.
-     * 
+     *
      * @param name the name of the <CODE>float</CODE>
      * @param value the <CODE>float</CODE> value to set in the Map
      * @throws JMSException if the JMS provider fails to write the message due
@@ -608,7 +616,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Sets a <CODE>double</CODE> value with the specified name into the Map.
-     * 
+     *
      * @param name the name of the <CODE>double</CODE>
      * @param value the <CODE>double</CODE> value to set in the Map
      * @throws JMSException if the JMS provider fails to write the message due
@@ -624,7 +632,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Sets a <CODE>String</CODE> value with the specified name into the Map.
-     * 
+     *
      * @param name the name of the <CODE>String</CODE>
      * @param value the <CODE>String</CODE> value to set in the Map
      * @throws JMSException if the JMS provider fails to write the message due
@@ -640,7 +648,7 @@ public class ActiveMQMapMessage extends 
 
     /**
      * Sets a byte array value with the specified name into the Map.
-     * 
+     *
      * @param name the name of the byte array
      * @param value the byte array value to set in the Map; the array is copied
      *                so that the value for <CODE>name </CODE> will not be
@@ -663,7 +671,7 @@ public class ActiveMQMapMessage extends 
     /**
      * Sets a portion of the byte array value with the specified name into the
      * Map.
-     * 
+     *
      * @param name the name of the byte array
      * @param value the byte array value to set in the Map
      * @param offset the initial offset within the byte array
@@ -687,7 +695,7 @@ public class ActiveMQMapMessage extends 
      * This method works only for the objectified primitive object types (<code>Integer</code>,<code>Double</code>,
      * <code>Long</code> &nbsp;...), <code>String</code> objects,
and byte
      * arrays.
-     * 
+     *
      * @param name the name of the Java object
      * @param value the Java object value to set in the Map
      * @throws JMSException if the JMS provider fails to write the message due
@@ -713,7 +721,7 @@ public class ActiveMQMapMessage extends 
     /**
      * Indicates whether an item exists in this <CODE>MapMessage</CODE>
      * object.
-     * 
+     *
      * @param name the name of the item to test
      * @return true if the item exists
      * @throws JMSException if the JMS provider fails to determine if the item



Mime
View raw message