Red Hat Bugzilla – Bug 989840
Example does not work on JDK 6
Last modified: 2016-02-21 19:56:30 EST
The example at https://access.redhat.com/site/documentation/en-US/JBoss_Operations_Network/3.1/html-single/Dev_Writing_JON_Command-Line_Scripts/index.html#Creating_the_JON_Scripts-Getting_inventory_and_status_information_out does not work with JDK, only JDK 7.
The code contains "criteria.addFilterExplicitGroupIds(group.id);" and the addFilterExplicitGroupIds() is a vararg method. Support for vararg methods was only added in 1.6R4 and JDK 6 uses 1.6R2 so this will fail with the error "Can't find method org.rhq.core.domain.criteria.ResourceCriteria.addFilterExplicitGroupIds(number)".
To do that on JDK 6, you need:
criteria = new ResourceCriteria();
var groupArray= new Array();
This is corrected to the JDK 6 example:
I left a comment in for the JDK 7 way to do it, in case it should be changed in the future.