changeset 6297:b600d490dc57

6783290: MBeanInfo/MBeanFeatureInfo has inconsistent readObject/writeObject Summary: call readObject in all cases Reviewed-by: emcmanus Contributed-by: jaroslav.bachorik@oracle.com
author dsamersoff
date Thu, 20 Dec 2012 16:02:42 +0400
parents 1f9c19741285
children e43f90d5af11
files src/share/classes/javax/management/MBeanFeatureInfo.java src/share/classes/javax/management/MBeanInfo.java
diffstat 2 files changed, 8 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/management/MBeanFeatureInfo.java	Wed Dec 19 11:53:52 2012 -0800
+++ b/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/src/share/classes/javax/management/MBeanInfo.java	Wed Dec 19 11:53:52 2012 -0800
+++ b/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: