Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 610107 - Search: expressions ending in whitespace are considered invalid
Search: expressions ending in whitespace are considered invalid
Status: CLOSED CURRENTRELEASE
Product: RHQ Project
Classification: Other
Component: SearchBar (Show other bugs)
3.0.0
All Linux
low Severity medium (vote)
: ---
: ---
Assigned To: Joseph Marques
John Sanda
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-01 11:11 EDT by Joseph Marques
Modified: 2010-08-12 12:53 EDT (History)
1 user (show)

See Also:
Fixed In Version: 2.4
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-08-12 12:53:03 EDT
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 2010-07-01 11:11:08 EDT
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 08:09:09 EDT
commit 5859a837d07167c1ea05ff08b501ab8104b0bf37
Author: Joseph Marques <joseph@redhat.com>
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 14:20:19 EDT
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 14:55:53 EDT
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 12:53:03 EDT
Mass-closure of verified bugs against JON.

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