After reading again the constructor Javadoc:

"sourceObj - source object, sending the notification. This is either an ObjectName or a RelationService object. In the latter case it must be the MBean emitting the notification; the MBean Server will rewrite the source to be the ObjectName under which that MBean is registered."

In this case, should we override instead the method "setSource" to refuse a null value and do the necessary check? like
   setSource(Object source) {
      if (!(sourceObj instanceof RelationService) &&
            !(sourceObj instanceof ObjectName))) {
           throw new IllegalArgumentException();
      }
   }
Shanliang

shanliang wrote:
The constructor Javadoc says: "Throws IllegalArgumentException if no source object", we have to modify the spec if the implementation is changed.

Shanliang

Dmitry Samersoff wrote:
Hi Everybody,

*problem*

Despite the fact, that validation in constructor of RelationNotification
prohibit creation of the class instance with null sourceObj its possible
to set it to null later by public setSource() method. So we should relax
validation rules to preserve serialization behavior compatibility.

*webrev*

http://cr.openjdk.java.net/~dsamersoff/8011038/webrev.01/

*testing*

JCK, no separate regression tests required.




Reply via email to