Bug 536457 (RHQ-803)

Summary: ClassCastException when specifying a pluginConfiguration or resourceConfiguration property whose type is logically an integer
Product: [Other] RHQ Project Reporter: Joseph Marques <jmarques>
Component: InventoryAssignee: Joseph Marques <jmarques>
Status: CLOSED NEXTRELEASE QA Contact: Jeff Weiss <jweiss>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.1preCC: dajohnso
Target Milestone: ---Keywords: SubBug
Target Release: ---   
Hardware: All   
OS: All   
URL: http://jira.rhq-project.org/browse/RHQ-803
Whiteboard:
Fixed In Version: 1.1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 536002    

Description Joseph Marques 2008-09-08 20:48:00 UTC
if you were to write a plugin for, say, JBossAS which could control the embedded Tomcat/JBossWeb Connector ports, an expression set might look like:

resource.type.plugin=JBossAS
resource.type.name.contains=Connector
groupby resource.parent.name
groupby resource.pluginConfiguration[port]

problem is the port value will always be an integer, ensured by configuration property validation rules.  but, when the expression evaluator tries to inspect the value to bind it to the query to create each individual group, it will bomb.  the expression evaluator doesn't know the different between a string and an integer, and so since a string is a superset of integer, attempts to cast bind values to the most specific type first.  for the port, the cast to integer succeeds...but as actually the wrong logic.  instead, we WANT port to be interpreted as a string value, because all properties values are string-i-fied in the database and need to use string comparisons.

there is a comment (several months old now) in ExpressionEvaluator.MultipleQueryIterator.getSingleResultList(String) explaining why i suspected this might blow up, as well as what it would take to fix things properly.

Comment 1 Joseph Marques 2008-09-10 13:33:22 UTC
rev1415 - provide a mechanism by which all SimpleProperties are interpreted as string types, even if they can be parsed as integers; 

Comment 2 Jeff Weiss 2008-09-22 17:59:42 UTC
Works on rev1547 build, the expr in the description now gives 5 groups, no errors.

Comment 3 Red Hat Bugzilla 2009-11-10 21:17:15 UTC
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-803