Bug 989840 - Example does not work on JDK 6
Example does not work on JDK 6
Status: CLOSED CURRENTRELEASE
Product: JBoss Operations Network
Classification: JBoss
Component: Documentation (Show other bugs)
JON 3.1.2
Unspecified Unspecified
unspecified Severity medium
: ---
: ---
Assigned To: Deon Ballard
Mike Foley
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-29 23:58 EDT by James Livingston
Modified: 2016-02-21 19:56 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-01-24 12:14:05 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description James Livingston 2013-07-29 23:58:37 EDT
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();
  groupArray[0]=group.id;
  criteria.addFilterExplicitGroupIds(groupArray);
Comment 1 Deon Ballard 2014-01-24 12:14:05 EST
This is corrected to the JDK 6 example:

https://access.redhat.com/site/documentation/en-US/Red_Hat_JBoss_Operations_Network/3.2/html/Writing_JON_Command-Line_Scripts/Control_Grouped_Servers_via_the_CLI.html#Creating_the_JON_Scripts-Getting_inventory_and_status_information_out

I left a comment in for the JDK 7 way to do it, in case it should be changed in the future.

Note You need to log in before you can comment on or make changes to this bug.