6783290: MBeanInfo/MBeanFeatureInfo has inconsistent readObject/writeObject
Summary: call readObject in all cases
Reviewed-by: emcmanus
Contributed-by: jaroslav.bachorik@oracle.com
--- 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: