From Ondra Machacek <omachace(a)redhat.com>:
Ondra Machacek has submitted this change and it was merged.
Change subject: Improve error message for wrong content type
......................................................................
Improve error message for wrong content type
Currently when the user specifies an incorrect URL path the SDK sends
requests to the server anyhow, and it tries to parse the response body
as XML, without checking the response content type. This generates error
messages that don't explain the root cause of the problem. To improve
that this patch changes the SDK so that it checks the content type of
the responses and generates error messages that explain better the
failure. For example, if the user specifies an incorrect URL path like
'/ugly', the SDK will try to contact the server and will raise an
exception containing the following error message:
The response content type 'text/html; charset=iso-8859-1' isn't
the expected XML. Is the path '/ugly' included in the 'url'
parameter correct? The typical one is '/ovirt-engine/api'
Change-Id: Ifc46f16fa65673bfde76d3ccc62dd5c3492cc289
Related-To:
https://bugzilla.redhat.com/1440292
Signed-off-by: Ondra Machacek <omachace(a)redhat.com>
Signed-off-by: Juan Hernandez <juan.hernandez(a)redhat.com>
---
M sdk/src/main/java/org/ovirt/engine/sdk4/internal/HttpConnection.java
1 file changed, 47 insertions(+), 1 deletion(-)
Approvals:
Ondra Machacek: Verified; Looks good to me, approved
Jenkins CI: Passed CI tests
--
To view, visit
https://gerrit.ovirt.org/75488
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifc46f16fa65673bfde76d3ccc62dd5c3492cc289
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-sdk-java
Gerrit-Branch: sdk_4.1
Gerrit-Owner: Ondra Machacek <omachace(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Ondra Machacek <omachace(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>