Bug 1352953 - show descriptive error message when sending a negative number like: {url}/events;max=-3
Summary: show descriptive error message when sending a negative number like: {url}/ev...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: Search-Backend
Version: 4.0.0
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ovirt-4.0.2
: 4.0.2
Assignee: Eli Mesika
QA Contact: Gonza
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-05 14:50 UTC by Tareq Alayan
Modified: 2016-07-26 10:52 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-07-26 10:52:18 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-4.0.z+
rule-engine: planning_ack+
mperina: devel_ack+
lsvaty: testing_ack+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 60917 0 master MERGED core: show descriptive error on illegal max value 2016-07-19 08:57:11 UTC
oVirt gerrit 61014 0 ovirt-engine-4.0 MERGED core: show descriptive error on illegal max value 2016-07-19 12:04:07 UTC

Description Tareq Alayan 2016-07-05 14:50:01 UTC
Description of problem:
when trying to get {engine_url}/ovirt-engine/api/events;max=-3

the error message returned is the postgresql message: 
<fault><detail>statementcallback; sql [select * from ((select distinct audit log.* from  audit log   where not deleted)  order by audit log id desc ) as t1 offset (1 -1) limit -2]; error: limit must not be negative; nested exception is org.postgresql.util.psqlexception: error: limit must not be negative</detail><reason>Operation Failed</reason></fault>


This should be replaced by application level error message

Version-Release number of selected component (if applicable):
rhevm-4.0.2-0.2.rc1.el7ev.noarch

How reproducible:
always


Steps to Reproduce:
1.GET {engine_url}/ovirt-engine/api/events;max=-3 


additional info: 
looks like all max functionality with other entities returns non decriptive error messages. 
i checked  ovirt-engine/api/tags;max=-2

and it returned 
<fault><detail>fromIndex(0) > toIndex(-2)</detail><reason>Operation Failed</reason></fault>

Comment 1 Yaniv Kaul 2016-07-18 13:50:44 UTC
I don't see what's the point of fixing such issues. What is the consequence of sending a negative number?

Comment 2 Eli Mesika 2016-07-18 14:01:16 UTC
(In reply to Yaniv Kaul from comment #1)
> I don't see what's the point of fixing such issues. What is the consequence
> of sending a negative number?

Sending a negative number is one issue and I agree that this is minor, but the bug is that the message of the exception thrown is not exposed to the API and it can occur in other scenarios as well since the exception is actually swallowed and just writes to the log so the respond returned to the API had a general failure with an unknown reason ...

Comment 3 Martin Perina 2016-07-19 08:57:57 UTC
Moving back to POST as we need to backport the patch to ovirt-engine-4.0 branch

Comment 4 Martin Perina 2016-07-19 12:05:54 UTC
Retargeting to 4.0.2 as patch is already merged to ovirt-engine-4.0 branch

Comment 5 Lukas Svaty 2016-07-26 10:52:18 UTC
This bug was fixed and is slated to be in the upcoming version. As we
are focusing our testing at this phase on severe bugs, this bug was
closed without going through its verification step. If you think this
bug should be verified by QE, please set its severity to high and move
it back to ON_QA


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