EVALUATION
This is not a bug. Part of the serialized form of a RelationNotification is its source. In the test code, the source is a RelationService, which is not a serializable object. It should be an ObjectName.
###@###.### 2003-08-21
According to the spec:
"theSrcObj - source object, sending the notification. Will always be a
RelationService object.".
In fact, an implementation of RelationNotification just throws IAE in case
something except RelationService is passed as the source object. How the test
code can put there ObjectName instead of RelationService?
###@###.### 2003-09-02
In fact, the specification is misleading. When the RelationNotification object is constructed, it is indeed given a RelationService object as an argument. However, when the RelationService subsequently emits that notification, the MBean server replaces the source with the ObjectName of the RelationService. This is defined JMX behaviour: when a Notification emitted by MBean X contains the object X as its source, the MBean server replaces X in the notification by X's ObjectName.
The correct fix would be to clarify the specification. However, since this is part of the JMX 1.2 implementation, we cannot strictly do that without doing a Maintenance Release of JMX. We can probably make exceptions for very important cases, but this is not one of them. Therefore, I'm suggesting either that this bug be closed, or that its priority be reduced. It may be better to close this bug and file a new one against the JMX documentation with priority 4 or 5.
###@###.### 2003-09-03
I'm reassigning this bug since I am unable to go further with it as it stands.
###@###.### 2003-09-25
Name: acR10002 Date: 09/25/2003
OK. If you agree this is a spec bug, then could you please reassign this bug to the appropriate tech/spec writer person? I'm not sure I can handle this in
either way, I'm even not in the JMX team. I'm OK with that bug is fixed
in later releases. This is new JCK tests, hence "No regression" rule
doesn't apply.
======================================================================
|
WORK AROUND
If the purpose of the test is to check that serialization of a RelationNotification is compatible, this could be done by creating a class like this:
package com.sun.whatever;
import javax.management.relation.RelationService;
import java.io.*;
public class SerializableRelationService extends RelationService implements Externalizable {
public SerializableRelationService() {
super(true);
}
public void writeExternal(ObjectOutput out) {}
public void readExternal(ObjectInput in) {}
}
Then an instance of RelationNotification can be constructed with a SerializableRelationService as its source, and that should be sufficient to test serialization compatibility.
###@###.### 2003-11-03
Yuri Gayevski points out that there is a much simpler solution. Construct a RelationService object, use it as the source when constructing a RelationNotification, then change the source to an ObjectName using RelationNotification.setSource. This works, and corresponds to what the MBean server does when forwarding a RelationNotification.
This is in fact what the serialization test in the standalone JMX TCK does. Even though I wrote that test, I had forgotten it when I suggested the other workaround.
###@###.### 2003-11-04
|