Vinzenz Feenstra has uploaded a new change for review.

Change subject: backend: initAppsList should not process null objects
......................................................................

backend: initAppsList should not process null objects

If the appsList contains non-strings or null values, a
null value would have been passed to the string builder.

This patch handles these cases and warns about wrong types
in the appsList.

Change-Id: Ia51bb09466a870695c0457679362f34ec9f6202f
Signed-off-by: Vinzenz Feenstra <vfeen...@redhat.com>
---
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/81/40381/1

diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
index a28fc3f..dbe90c7 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
@@ -1389,6 +1389,12 @@
                     String appString = (String) ((app instanceof String) ? app 
: null);
                     if (app == null) {
                         log.warn("Failed to convert app: [null] to string");
+                        continue; // Don't process this
+                    }
+                    if(appString == null) {
+                        // Note: app cannot be null here anymore
+                        log.warn("Failed to convert app: [" + 
app.getClass().getName() + "] is not a string");
+                        continue; // Don't process this
                     }
                     if (!firstTime) {
                         builder.append(",");


-- 
To view, visit https://gerrit.ovirt.org/40381
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia51bb09466a870695c0457679362f34ec9f6202f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeen...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to