Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6783290

MBeanInfo/MBeanFeatureInfo has inconsistent readObject/writeObject

    XMLWordPrintable

Details

    • b71
    • generic
    • generic
    • Not verified

    Description

      Since the addition of Descriptors to all kinds of MBeanInfo (rather than just ModelMBeanInfo as before), an inconsistency has appeared in the serialization of MBeanFeatureInfo when its Descriptor is an empty ImmutableDescriptor.

      MBeanFeatureInfo.writeObject(ObjectOutputStream out) does the following in this case:

      out.write(1);

      final String[] names = descriptor.getFieldNames();

      out.writeObject(names);
      out.writeObject(descriptor.getFieldValues(names));

      MBeanFeatureInfo.readObject(ObjectInputStream in) does this:

      switch (in.read()) {
      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);
      }

      The problem is that when names.length == 0 we do not read the zero-length Object[] written by out.writeObject(descriptor.getFieldValues(names)). The serialization specification is unclear as to what happens when a readObject does not consume all the "optional data". Native serialization (as used by RMI/JRMP) just discards the unread data, but RMI/IIOP implementations might not.

      Attachments

        Issue Links

          Activity

            People

              jbachorik Jaroslav BachorĂ­k
              emcmanus Eamonn McManus
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: