Bug 610107

Summary: Search: expressions ending in whitespace are considered invalid
Product: [Other] RHQ Project Reporter: Joseph Marques <jmarques>
Component: SearchBarAssignee: Joseph Marques <jmarques>
Status: CLOSED CURRENTRELEASE QA Contact: John Sanda <jsanda>
Severity: medium Docs Contact:
Priority: low    
Version: 3.0.0CC: jsanda
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 2.4 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-08-12 16:53:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Joseph Marques 2010-07-01 15:11:08 UTC
In the resource browser or group browser, if you type any valid search expression it will filter the result list.  However, if you add any whitespace to the end of it, the parser thinks the last search term is NULL, which bombs during query translation.  As a result, the entire search expression is mark as invalid, and no results are filtered at all.

Comment 1 Joseph Marques 2010-07-09 12:09:09 UTC
commit 5859a837d07167c1ea05ff08b501ab8104b0bf37
Author: Joseph Marques <joseph>
Date:   Thu Jul 8 18:56:10 2010 -0400

BZ-610107: ensure search expression for translation into JPQL is whitespace-trimmed and non-null

Comment 2 John Sanda 2010-07-12 18:20:19 UTC
Testing on build 139 of ci-rhq-release hudson job.

In the search bar I first tried,

type="JBossAS Server"

which listed my one and only jboss instance in inventory, my rhq server. I then tried,

type="JBossAS Server   "

No results were yielded, and I did not see any errors in the log. I then tried,

type!="JBossAS Server"

and it returned a number of results which excluded JBossAS Server. Next I tried,

type=""

and I saw the following error message in the server log,

ERROR [org.rhq.enterprise.server.util.CriteriaQueryGenerator] Could not get JPQL translation for 'type=""': org.antlr.runtime.tree.RewriteEmptyStreamException:rule doubleQuotedValue

but results were returned. I repeated the search strings again getting the same results. On the platforms subtab I also tried,

category="platform   "

which resulted in the following error in the server log,

ERROR [org.rhq.enterprise.server.util.CriteriaQueryGenerator] Could not get JPQL translation for 'category="platform   "': java.lang.IllegalArgumentException:No enum of type 'ResourceCategory' with name matching 'platform   '

but my one and only platform in inventory was returned. I then tried

category="platform",

and I got the same result without any error message in the log.

Comment 3 John Sanda 2010-07-12 18:55:53 UTC
I have verified with Joseph that the error messages in the logs are in fact expected. I have also tested without his fix, and that winds up displaying the error message in the UI as well. Marking this verified.

Comment 4 Corey Welton 2010-08-12 16:53:03 UTC
Mass-closure of verified bugs against JON.