changeset 6731:675b9971b25b

Merge
author asaha
date Tue, 06 Aug 2013 07:34:07 -0700
parents cb81fafffb8d 5d9bbfa0096f
children 480b85c53071
files
diffstat 1 files changed, 25 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/management/BadAttributeValueExpException.java	Mon Aug 05 13:48:13 2013 -0700
+++ b/src/share/classes/javax/management/BadAttributeValueExpException.java	Tue Aug 06 07:34:07 2013 -0700
@@ -25,6 +25,9 @@
 
 package javax.management;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+
 
 /**
  * Thrown when an invalid MBean attribute is passed to a query
@@ -51,7 +54,7 @@
      * @param val the inappropriate value.
      */
     public BadAttributeValueExpException (Object val) {
-        this.val = val;
+        this.val = val == null ? null : val.toString();
     }
 
 
@@ -62,4 +65,25 @@
         return "BadAttributeValueException: " + val;
     }
 
+    private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
+        ObjectInputStream.GetField gf = ois.readFields();
+        Object valObj = gf.get("val", null);
+
+        if (valObj == null) {
+            val = null;
+        } else if (valObj instanceof String) {
+            val= valObj;
+        } else if (System.getSecurityManager() == null
+                || valObj instanceof Long
+                || valObj instanceof Integer
+                || valObj instanceof Float
+                || valObj instanceof Double
+                || valObj instanceof Byte
+                || valObj instanceof Short
+                || valObj instanceof Boolean) {
+            val = valObj.toString();
+        } else { // the serialized object is from a version without JDK-8019292 fix
+            val = System.identityHashCode(valObj) + "@" + valObj.getClass().getName();
+        }
+    }
  }