Bug 1273932 - RestAPI returns 500 instead of 400 when sending invalid JSON
Summary: RestAPI returns 500 instead of 400 when sending invalid JSON
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: 4.0.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: ovirt-4.0.0-alpha
: 4.0.0
Assignee: Roman Mohr
QA Contact: Lucie Leistnerova
Depends On:
TreeView+ depends on / blocked
Reported: 2015-10-21 14:12 UTC by Roman Mohr
Modified: 2016-08-17 14:37 UTC (History)
3 users (show)

Fixed In Version: ovirt 4.0.0 alpha1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2016-08-17 14:37:05 UTC
oVirt Team: Infra
juan.hernandez: ovirt-4.0.0?
rule-engine: planning_ack+
juan.hernandez: devel_ack+
pstehlik: testing_ack+

Attachments (Terms of Use)
server.log (3.75 MB, text/plain)
2015-10-21 14:12 UTC, Roman Mohr
no flags Details

System ID Private Priority Status Summary Last Updated
oVirt gerrit 47584 0 master MERGED restapi: Add missing dependency to restapi-definition module Never

Description Roman Mohr 2015-10-21 14:12:47 UTC
Created attachment 1085142 [details]

Description of problem:

Version-Release number of selected component (if applicable):

How reproducible:

Send a json to the server with non existing fields.

Steps to Reproduce:
1.PUT to https://localhost:8443/ovirt-engine/api/clusters/<cluster:id>
"scheduling_policy" : { "policy" : "test_policy"}

Actual results:

Receiving an internal server error (500) instead of invalid request(400)

Expected results:

Receiving invalid request(400)

Additional info:

In server.log:

  Caused by: java.lang.ClassNotFoundException: org.yaml.snakeyaml.constructor.BaseConstructor from [Module "org.ovirt.engine.api.restapi-definition:main" from local m      odule loader @627551fb (finder: local module finder @2b552920 (roots: /home/rmohr/ovirt-engines/master/var/lib/ovirt-engine/jboss_runtime/modules/00-modules-common,      /home/rmohr/ovirt-engines/master/var/lib/ovirt-engine/jboss_runtime/modules/01-ovirt-engine-extension-aaa-jdbc-modules,/home/rmohr/ovirt-engines/master/var/lib/ovir      t-engine/jboss_runtime/modules/02-ovirt-engine-wildfly-modules,/home/rmohr/ovirt-engines/master/var/lib/ovirt-engine/jboss_runtime/modules/02-ovirt-engine-wildfly-m      odules/system/layers/base))]

In engine.log:
  2015-10-21 15:43:15,948 ERROR [org.ovirt.engine.api.restapi.resource.validation.JsonExceptionMapper] (default task-1) [] Exception: org.codehaus.jackson.map.exc.Un       recognizedPropertyException: Unrecognized field "policy" (Class org.ovirt.engine.api.model.SchedulingPolicy), not marked as ignorable

Comment 1 Juan Hernández 2015-10-21 14:27:57 UTC
Is "Version" correct, did you find this issue in the 3.6 branch?

Comment 2 Roman Mohr 2015-10-21 14:31:03 UTC
Was on master. Corrected that. Will try to reproduce it on the 3.6 branch.

Comment 3 Juan Hernández 2015-10-21 14:32:01 UTC
This won't happen in 3.6, it is a side effect of removing YAML support, and that only happened in the master branch.

Comment 4 Lucie Leistnerova 2016-08-17 08:28:22 UTC
call with mentioned json or syntactically incorrect json returns 400 Bad Request

verified in ovirt-engine-restapi-

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