Bug 989840 - Example does not work on JDK 6
Summary: Example does not work on JDK 6
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Documentation
Version: JON 3.1.2
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: ---
Assignee: Deon Ballard
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-07-30 03:58 UTC by James Livingston
Modified: 2018-12-02 15:53 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-24 17:14:05 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description James Livingston 2013-07-30 03:58:37 UTC
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 17:14:05 UTC
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.