[jboss-dev-forums] [Design of Management Features on JBoss] - Re: JBAS-6672, null values and defaults

scott.stark@jboss.org do-not-reply at jboss.com
Thu Apr 2 12:05:35 EDT 2009


"ips" wrote : 
  | 1) Will:
  | 
  | managedComponent.getProperties().remove("foo")
  | 
  | be semantically equivalent to:
  | 
  | managedComponent.getProperty("foo").setRemoved(true)
  | 
  | ? (I think it should be)
  | 
  | 
Yes it should.

"ips" wrote : 
  | 2) Will managementView.updateComponent() throw an Exception if for a property (managedProperty.isMandatory() && managedProperty.isRemoved()) is true? I think it should, because not specifying a value for a mandatory property should be considered a client error. The other option would be having setRemoved(true) throw an Exception if the prop is mandatory.
  | 
I would say calling setRemoved(true) on a manadatory property is where the exception should be thrown. Right now that is not the case so an update to jboss-managed would be needed. We can have a duplicate check in the server updateComponent code to add that behavior now, and ensure the server enforces the expected behavior.

"ips" wrote : 
  | 3) I think primitive SimpleValues should not be allowed to have a value of null. They are primitive after all. Either updateComponent() could throw an Excpetion, or, to nip it in the bud, the impl of setValue() in SimpleValueSupport could be changed to:
  | 
  |    public void setValue(Serializable value)
  |   |    {
  |   |       if (value == null && this.metatype.isPrimitive())
  |   |           throw new IllegalArgumentException("Primitive SimpleValues cannot have a value of null.");
  |   |       this.value = value;
  |   |    }
  | 
The latest jboss-managed 2.1.0.CR6 simply maps MetaValues with null values onto the corresponding primitive unintialized value when the MetaValue is unwrapped, so essentially there is no way a primitive will have a null value. I view this as akin to auto promotion of nulls so that one does not have to track whether a property is a primitive.


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4223071#4223071

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4223071



More information about the jboss-dev-forums mailing list