Daniel Erez has uploaded a new change for review.

Change subject: webadmin: prevent NPE in ClusterModel
......................................................................

webadmin: prevent NPE in ClusterModel

CustomPropertySheet should be validated only when it's available.
Hence, disable validation on ConfigureLocalStorage.

Change-Id: I1267a43408e2580e7f301ae6bed5dfe8735aed14
Signed-off-by: Daniel Erez <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/ConfigureLocalStorageModel.java
2 files changed, 8 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/32/17132/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
index a2f60de..a41a690 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
@@ -1244,10 +1244,10 @@
 
     public boolean validate(boolean validateCpu)
     {
-        return validate(true, validateCpu);
+        return validate(true, validateCpu, true);
     }
 
-    public boolean validate(boolean validateStoragePool, boolean validateCpu)
+    public boolean validate(boolean validateStoragePool, boolean validateCpu, 
boolean validateCustomProperties)
     {
         getName().validateEntity(new IValidation[] {
                 new NotEmptyValidation(),
@@ -1266,6 +1266,10 @@
         else
         {
             getCPU().validateSelectedItem(new IValidation[] {});
+        }
+
+        if (validateCustomProperties) {
+            
getCustomPropertySheet().setIsValid(getCustomPropertySheet().validate());
         }
 
         getVersion().validateSelectedItem(new IValidation[] { new 
NotEmptyValidation() });
@@ -1317,7 +1321,7 @@
                 && getGlusterHostPassword().getIsValid()
                 && ((Boolean) getIsImportGlusterConfiguration().getEntity() ? 
(getGlusterHostAddress().getIsValid()
                         && getGlusterHostPassword().getIsValid()
-                        && isFingerprintVerified()) : true) && 
getCustomPropertySheet().validate();
+                        && isFingerprintVerified()) : true) && 
getCustomPropertySheet().getIsValid();
     }
 
 }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/ConfigureLocalStorageModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/ConfigureLocalStorageModel.java
index 3916267..5b0d503 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/ConfigureLocalStorageModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/ConfigureLocalStorageModel.java
@@ -207,7 +207,7 @@
         }
         boolean isClusterValid = true;
         if (getCandidateCluster() == null) {
-            isClusterValid = getCluster().validate(false, true);
+            isClusterValid = getCluster().validate(false, true, false);
         }
 
         setIsGeneralTabValid(isStorageValid && isDataCenterValid && 
isClusterValid);


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

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

Reply via email to