Bug 536457 (RHQ-803) - ClassCastException when specifying a pluginConfiguration or resourceConfiguration property whose type is logically an integer
Summary: ClassCastException when specifying a pluginConfiguration or resourceConfigura...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: RHQ-803
Product: RHQ Project
Classification: Other
Component: Inventory
Version: 1.1pre
Hardware: All
OS: All
medium
medium
Target Milestone: ---
: ---
Assignee: Joseph Marques
QA Contact: Jeff Weiss
URL: http://jira.rhq-project.org/browse/RH...
Whiteboard:
Depends On:
Blocks: RHQ-399
TreeView+ depends on / blocked
 
Reported: 2008-09-08 20:48 UTC by Joseph Marques
Modified: 2014-11-09 22:50 UTC (History)
1 user (show)

Fixed In Version: 1.1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

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



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