Bug 586918 - AlertDefinitionCriteria throws ClassCastException if filterAlertTemplateParentId / filterAlertTemplateResourceTypeId is set
Summary: AlertDefinitionCriteria throws ClassCastException if filterAlertTemplateParen...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: CLI
Version: 3.0.0
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
: ---
Assignee: Joseph Marques
QA Contact: Sudhir D
URL:
Whiteboard:
Depends On:
Blocks: jon-sprint9-bugs
TreeView+ depends on / blocked
 
Reported: 2010-04-28 14:05 UTC by Joseph Marques
Modified: 2010-08-12 16:54 UTC (History)
1 user (show)

Fixed In Version: 2.4
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-08-12 16:54:08 UTC
Embargoed:


Attachments (Terms of Use)

Description Joseph Marques 2010-04-28 14:05:02 UTC
Steps to Reproduce:

rhqadmin.209.93:7780$ var c1 = new AlertDefinitionCriteria()
rhqadmin.209.93:7780$ c1.addFilterAlertTemplateParentId(<someId>)
rhqadmin.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 14:07:56 UTC
commit 303467aeda8d90b48cb68581d53211c774a82fd5

fix for ClassCastException when using AlertDefinitionCriteria when filtering by either alertTemplateParentId or alertTemplateResourceTypeId

Comment 2 Sudhir D 2010-05-26 09:30:04 UTC
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.redhat.com:7080$ var c1 = new AlertDefinitionCriteria()

rhqadmin.redhat.com:7080$ c1.addFilterAlertTemplateParentId(10031)

rhqadmin.redhat.com:7080$ 
rhqadmin.redhat.com:7080$ var c1 = new AlertDefinitionCriteria()  

rhqadmin.redhat.com:7080$ c1.addFilterAlertTemplateParentId(10032)

rhqadmin.redhat.com:7080$ 
rhqadmin.redhat.com:7080$ var c1 = new AlertDefinitionCriteria()  

rhqadmin.redhat.com:7080$ c1.addFilterAlertTemplateParentId(10033)

rhqadmin.redhat.com:7080$ 
rhqadmin.redhat.com:7080$ 

I tried with all the other IDs too, but no output.

Comment 3 Joseph Marques 2010-05-26 14:05:12 UTC
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 11:36:37 UTC
Ah, my fault. I retried and below is the output.

rhqadmin.redhat.com:7080$ var c1 = new AlertDefinitionCriteria()

rhqadmin.redhat.com:7080$ c1.addFilterAlertTemplateParentId(10001)

rhqadmin.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 16:54:08 UTC
Mass-closure of verified bugs against JON.


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