Bug 586918 - AlertDefinitionCriteria throws ClassCastException if filterAlertTemplateParentId / filterAlertTemplateResourceTypeId is set
AlertDefinitionCriteria throws ClassCastException if filterAlertTemplateParen...
Status: CLOSED CURRENTRELEASE
Product: RHQ Project
Classification: Other
Component: CLI (Show other bugs)
3.0.0
All Linux
low Severity medium (vote)
: ---
: ---
Assigned To: Joseph Marques
Sudhir D
:
Depends On:
Blocks: jon-sprint9-bugs
  Show dependency treegraph
 
Reported: 2010-04-28 10:05 EDT by Joseph Marques
Modified: 2010-08-12 12:54 EDT (History)
1 user (show)

See Also:
Fixed In Version: 2.4
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-08-12 12:54:08 EDT
Type: ---
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 Joseph Marques 2010-04-28 10:05:02 EDT
Steps to Reproduce:

rhqadmin@192.168.209.93:7780$ var c1 = new AlertDefinitionCriteria()
rhqadmin@192.168.209.93:7780$ c1.addFilterAlertTemplateParentId(<someId>)
rhqadmin@192.168.209.93:7780$ AlertDefinitionManager.findAlertDefinitionsByCriteria(c1)

Expected results:

Filters the results by those alert definitions that were automatically created from an alert template with id = <someId>

Actual results:

[Warning] javax.ejb.EJBException: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer

Additional info:

This bug manifested itself through the CLI, though it would affect any other use of this particular criteria object.
Comment 1 Joseph Marques 2010-04-28 10:07:56 EDT
commit 303467aeda8d90b48cb68581d53211c774a82fd5

fix for ClassCastException when using AlertDefinitionCriteria when filtering by either alertTemplateParentId or alertTemplateResourceTypeId
Comment 2 Sudhir D 2010-05-26 05:30:04 EDT
I tried this out on Build# 166 Version: 2.4 SNAPSHOT.

I don't seem to get any output. I'm not seeing any error though. 

Below is what I did. 

1. Created a new alert template at platform level Linux.
2. Ran the below SQL query to identify the ID
  template1=# select id,description from rhq_alert_definition;
    id   |           description            
  -------+----------------------------------
   10001 | Group alert for linux group type
   10011 | Alert for an event
   10021 | Platform event alert
   10031 | linux alert template
   10032 | linux alert template
   10033 | linux alert template
  (6 rows)

3. Installed the CLI and ran the below commands, 

[root@dhcp6-150 bin]# ./rhq-cli.sh -u rhqadmin -P -s dhcp6-150.pnq.redhat.com -t 7080
password: 
RHQ - RHQ Enterprise Remote CLI 3.0.0-SNAPSHOT
Remote server version is: 3.0.0-SNAPSHOT(53d34d5)
Login successful
rhqadmin@dhcp6-150.pnq.redhat.com:7080$ var c1 = new AlertDefinitionCriteria()

rhqadmin@dhcp6-150.pnq.redhat.com:7080$ c1.addFilterAlertTemplateParentId(10031)

rhqadmin@dhcp6-150.pnq.redhat.com:7080$ 
rhqadmin@dhcp6-150.pnq.redhat.com:7080$ var c1 = new AlertDefinitionCriteria()  

rhqadmin@dhcp6-150.pnq.redhat.com:7080$ c1.addFilterAlertTemplateParentId(10032)

rhqadmin@dhcp6-150.pnq.redhat.com:7080$ 
rhqadmin@dhcp6-150.pnq.redhat.com:7080$ var c1 = new AlertDefinitionCriteria()  

rhqadmin@dhcp6-150.pnq.redhat.com:7080$ c1.addFilterAlertTemplateParentId(10033)

rhqadmin@dhcp6-150.pnq.redhat.com:7080$ 
rhqadmin@dhcp6-150.pnq.redhat.com:7080$ 

I tried with all the other IDs too, but no output.
Comment 3 Joseph Marques 2010-05-26 10:05:12 EDT
please re-read the reproduction steps.  you missing the line where it said to execute "AlertDefinitionManager.findAlertDefinitionsByCriteria(c1)"
Comment 4 Sudhir D 2010-05-27 07:36:37 EDT
Ah, my fault. I retried and below is the output.

rhqadmin@dhcp6-150.pnq.redhat.com:7080$ var c1 = new AlertDefinitionCriteria()

rhqadmin@dhcp6-150.pnq.redhat.com:7080$ c1.addFilterAlertTemplateParentId(10001)

rhqadmin@dhcp6-150.pnq.redhat.com:7080$ AlertDefinitionManager.findAlertDefinitionsByCriteria(c1)
one row
AlertDefinition:
	     alertDampening: org.rhq.core.domain.alert.AlertDampening[ category=NONE[] ]
	conditionExpression: ANY
	            context: Resource
	    controlFiltered: false
	              ctime: 1275046299710
	            deleted: false
	        description: Linux alert template
	            enabled: true
	                 id: 10002
	              mtime: 1275046299710
	               name: Linux System Load Alert
	     notifyFiltered: false
	           parentId: 10001
	           priority: !! - Medium
	           readOnly: false
	         recoveryId: 0
	           resource: Resource[id=10001, type=Linux, key=dhcp6-150.pnq.redhat.com-embedded, name=dhcp6-150.pnq.redhat.com-embedded, parent=<null>, version=Linux 2.6.18-164.11.1.el5]
	        willRecover: false

Marking this bug as verified.
Comment 5 Corey Welton 2010-08-12 12:54:08 EDT
Mass-closure of verified bugs against JON.

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