JDK-6305139 : ImmutableDescriptor.setFields does not wrap IAE as said in Descriptor interface
  • Type: Bug
  • Component: core-svc
  • Sub-Component: javax.management
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2005-08-02
  • Updated: 2012-03-23
  • Resolved: 2005-12-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b61Fixed
Related Reports
Relates :  
Description
.
.
.
As of Mustang b45, the Descriptor.setFields() javadoc says (extract):

[...]
Throws:
    RuntimeOperationsException - if the change fails for any reason. Wrapped exception is IllegalArgumentException if fieldNames or fieldValues is null, or if the arrays are of different lengths, or if there is an illegal value in one of them. Wrapped exception is UnsupportedOperationException if the descriptor is immutable, and the call would change its contents.
[...]

and the ImmutableDescriptor.setFields() javadoc says (extract):

[...]
Throws:
    RuntimeOperationsException - for illegal value for field Names or field Values. Neither can be null. The array lengths must be equal. If the call would succeed on a mutable descriptor and change its contents, then this exception will be thrown and the wrapped exception will be UnsupportedOperationException.
[...]

1) The latter javadoc should be aligned on the former.
2) The current implementation is not compliant in the case there is an illegal value in the fieldNames array. With both empty String and null values, a RuntimeOperationsException is effectively thrown but the awaited wrapped IllegalArgumentException is not there. 
Notice modelmbean.DescriptorSupport.setFields() does the expected exception wrapping (so there is an asymmetry).

Comments
EVALUATION ImmutableDescriptor behavior must be aligned with the behavior specified by the Descriptor interface.
11-10-2005