Vojtech Szocs has uploaded a new change for review.

Change subject: webadmin: Check HTTP response status for Reports.xml
......................................................................

webadmin: Check HTTP response status for Reports.xml

In ReportInit.parseReportsXML method, HTTP response status
should be checked first, before trying to parse response
text as XML.

For example, missing Reports.xml will cause 404 (not found)
HTTP response, with response text being HTML (error page).

Change-Id: I40823031291c6223cf9acb484e5b20d74baa8142
Signed-off-by: Vojtech Szocs <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/ReportInit.java
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/12/7512/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/ReportInit.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/ReportInit.java
index 825ec3a..6b9f15a 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/ReportInit.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/ReportInit.java
@@ -95,7 +95,8 @@
                 @Override
                 public void onResponseReceived(Request request, Response 
response) {
                     try {
-                        if 
(ReportParser.getInstance().parseReport(response.getText())) {
+                        if (response.getStatusCode() == Response.SC_OK
+                                && 
ReportParser.getInstance().parseReport(response.getText())) {
                             resourceMap = 
ReportParser.getInstance().getResourceMap();
                             dashboardMap = 
ReportParser.getInstance().getDashboardMap();
                             isCommunityEdition = 
ReportParser.getInstance().isCommunityEdition();


--
To view, visit http://gerrit.ovirt.org/7512
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I40823031291c6223cf9acb484e5b20d74baa8142
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Vojtech Szocs <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to