<< Back to previous view

[JMX-7] Extend Destract protocol on nil to handle Null references gracefully Created: 23/Aug/12  Updated: 26/Jul/13  Resolved: 18/Sep/12

Status: Resolved
Project: java.jmx
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Jürgen Hötzel Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: bug

Attachments: Text File 0001-fix-duplicate-definition-of-test-objects-data.patch     Text File 0002-Test-Destract-protocol-on-nil-refs-JMX-7.patch     Text File 0003-Extend-Destract-protocol-on-nil-to-handle-null-refer.patch    
Patch: Code and Test
Approval: Accepted


JMX Attributes can have null references. Currently a Exception is thrown because the "null-type" is not handled via objects->data:

user> (jmx/mbean "java.lang:type=GarbageCollector,name=PS MarkSweep")
{:LastGcInfo #<IllegalArgumentException java.lang.IllegalArgumentException: No implementation of method: :objects->data of protocol: #'clojure.java.jmx/Destract found for class: nil>, :CollectionCount 0, :CollectionTime 0, :MemoryPoolNames #<String[] [Ljava.lang.String;@57b8fe29>, :Name "PS MarkSweep", :Valid true, :ObjectName #<ObjectName java.lang:type=GarbageCollector,name=PS MarkSweep>}

After applying this patch:

user> (jmx/mbean "java.lang:type=GarbageCollector,name=PS MarkSweep")
{:LastGcInfo nil, :CollectionCount 0, :CollectionTime 0, :MemoryPoolNames #<String[] [Ljava.lang.String;@2225be1e>, :Name "PS MarkSweep", :Valid true, :ObjectName #<ObjectName java.lang:type=GarbageCollector,name=PS MarkSweep>}

Comment by Nick Bailey [ 31/Aug/12 4:42 PM ]

I don't suppose you know of a standard mbean that ships with most jvms we could use to write a test case for this?

Comment by Jürgen Hötzel [ 10/Sep/12 9:21 AM ]

I don't know of a standard MBean attribute which is reproducible Null. "LastGcInfo" of "java.lang:type=GarbageCollector,name=PS MarkSweep" is non-Null after a garbage collection.

I think its better to test the Destract protocol directly instead of using a "live" MBean in this case.

BTW. there was also a duplicate definition of the existing Destract tests in test-objects->data. Patches enclosed.

Comment by Nick Bailey [ 18/Sep/12 11:20 PM ]



Generated at Mon Sep 01 21:34:16 CDT 2014 using JIRA 4.4#649-r158309.