Bug 536457 - (RHQ-803) ClassCastException when specifying a pluginConfiguration or resourceConfiguration property whose type is logically an integer
ClassCastException when specifying a pluginConfiguration or resourceConfigura...
Status: CLOSED NEXTRELEASE
Product: RHQ Project
Classification: Other
Component: Inventory (Show other bugs)
1.1pre
All All
medium Severity medium (vote)
: ---
: ---
Assigned To: Joseph Marques
Jeff Weiss
http://jira.rhq-project.org/browse/RH...
: SubBug
Depends On:
Blocks: RHQ-399
  Show dependency treegraph
 
Reported: 2008-09-08 16:48 EDT by Joseph Marques
Modified: 2014-11-09 17:50 EST (History)
1 user (show)

See Also:
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: ---


Attachments (Terms of Use)

  None (edit)
Description Joseph Marques 2008-09-08 16:48:00 EDT
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 09:33:22 EDT
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 13:59:42 EDT
Works on rev1547 build, the expr in the description now gives 5 groups, no errors.
Comment 3 Red Hat Bugzilla 2009-11-10 16:17:15 EST
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.