6783290: MBeanInfo/MBeanFeatureInfo has inconsistent readObject/writeObject
authordsamersoff
Thu, 20 Dec 2012 16:02:42 +0400
changeset 14911 404c8c3c91ee
parent 14910 337380568515
child 14912 e6fc057a8011
6783290: MBeanInfo/MBeanFeatureInfo has inconsistent readObject/writeObject Summary: call readObject in all cases Reviewed-by: emcmanus Contributed-by: jaroslav.bachorik@oracle.com
jdk/src/share/classes/javax/management/MBeanFeatureInfo.java
jdk/src/share/classes/javax/management/MBeanInfo.java
--- a/jdk/src/share/classes/javax/management/MBeanFeatureInfo.java	Wed Dec 19 11:53:52 2012 -0800
+++ b/jdk/src/share/classes/javax/management/MBeanFeatureInfo.java	Thu Dec 20 16:02:42 2012 +0400
@@ -239,12 +239,10 @@
         case 1:
             final String[] names = (String[])in.readObject();
 
-            if (names.length == 0) {
-                descriptor = ImmutableDescriptor.EMPTY_DESCRIPTOR;
-            } else {
-                final Object[] values = (Object[])in.readObject();
-                descriptor = new ImmutableDescriptor(names, values);
-            }
+            final Object[] values = (Object[]) in.readObject();
+            descriptor = (names.length == 0) ?
+                ImmutableDescriptor.EMPTY_DESCRIPTOR :
+                new ImmutableDescriptor(names, values);
 
             break;
         case 0:
--- a/jdk/src/share/classes/javax/management/MBeanInfo.java	Wed Dec 19 11:53:52 2012 -0800
+++ b/jdk/src/share/classes/javax/management/MBeanInfo.java	Thu Dec 20 16:02:42 2012 +0400
@@ -704,12 +704,10 @@
         case 1:
             final String[] names = (String[])in.readObject();
 
-            if (names.length == 0) {
-                descriptor = ImmutableDescriptor.EMPTY_DESCRIPTOR;
-            } else {
-                final Object[] values = (Object[])in.readObject();
-                descriptor = new ImmutableDescriptor(names, values);
-            }
+            final Object[] values = (Object[]) in.readObject();
+            descriptor = (names.length == 0) ?
+                ImmutableDescriptor.EMPTY_DESCRIPTOR :
+                new ImmutableDescriptor(names, values);
 
             break;
         case 0: