jdk/src/share/classes/javax/management/modelmbean/ModelMBeanInfoSupport.java
changeset 4156 acaa49a2768a
parent 1004 5ba8217eb504
child 5506 202f599c92aa
equal deleted inserted replaced
4155:460e37d40f12 4156:acaa49a2768a
   943      * an empty Descriptor.
   943      * an empty Descriptor.
   944      * @exception RuntimeOperationsException if Descriptor is invalid
   944      * @exception RuntimeOperationsException if Descriptor is invalid
   945      */
   945      */
   946     private Descriptor validDescriptor(final Descriptor in) throws RuntimeOperationsException {
   946     private Descriptor validDescriptor(final Descriptor in) throws RuntimeOperationsException {
   947         Descriptor clone;
   947         Descriptor clone;
   948         if (in == null) {
   948         boolean defaulted = (in == null);
       
   949         if (defaulted) {
   949             clone = new DescriptorSupport();
   950             clone = new DescriptorSupport();
   950             MODELMBEAN_LOGGER.finer("Null Descriptor, creating new.");
   951             MODELMBEAN_LOGGER.finer("Null Descriptor, creating new.");
   951         } else {
   952         } else {
   952             clone = (Descriptor) in.clone();
   953             clone = (Descriptor) in.clone();
   953         }
   954         }
   954 
   955 
   955         //Setting defaults.
   956         //Setting defaults.
   956         if (clone.getFieldValue("name")==null) {
   957         if (defaulted && clone.getFieldValue("name")==null) {
   957             clone.setField("name", this.getClassName());
   958             clone.setField("name", this.getClassName());
   958             MODELMBEAN_LOGGER.finer("Defaulting Descriptor name to " + this.getClassName());
   959             MODELMBEAN_LOGGER.finer("Defaulting Descriptor name to " + this.getClassName());
   959         }
   960         }
   960         if (clone.getFieldValue("descriptorType")==null) {
   961         if (defaulted && clone.getFieldValue("descriptorType")==null) {
   961             clone.setField("descriptorType", MMB);
   962             clone.setField("descriptorType", MMB);
   962             MODELMBEAN_LOGGER.finer("Defaulting descriptorType to \"" + MMB + "\"");
   963             MODELMBEAN_LOGGER.finer("Defaulting descriptorType to \"" + MMB + "\"");
   963         }
   964         }
   964         if (clone.getFieldValue("displayName") == null) {
   965         if (clone.getFieldValue("displayName") == null) {
   965             clone.setField("displayName",this.getClassName());
   966             clone.setField("displayName",this.getClassName());