Maor Lipchuk has uploaded a new change for review.

Change subject: core: Verify that date is initialized in OVF_STORE disk
......................................................................

core: Verify that date is initialized in OVF_STORE disk

Verify that the last_update date is initizlied in the OVF_STORE disk to prevent 
NPE.
If the last_update date is not initialized in the disk we don't count
this disk to be retrieved, unregistered entities, from, since it is not
initilized with entities.

Change-Id: I8e59086ce7242d7aaec10b57b6775ab968c9fe1c
Bug-Url: https://bugzilla.redhat.com/1130976
Signed-off-by: Maor Lipchuk <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AttachStorageDomainToPoolCommand.java
1 file changed, 10 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/63/32963/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AttachStorageDomainToPoolCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AttachStorageDomainToPoolCommand.java
index dc5a51e..9b9f434 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AttachStorageDomainToPoolCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AttachStorageDomainToPoolCommand.java
@@ -322,7 +322,9 @@
 
             boolean isUpdated = 
Boolean.valueOf(diskDescriptionMap.get(OvfInfoFileConstants.IsUpdated).toString());
             Date date = getDateFromDiskDescription(diskDescriptionMap);
-
+            if (date == null) {
+                continue;
+            }
             if (isFoundOvfDiskUpdated && !isUpdated) {
                 continue;
             }
@@ -341,12 +343,16 @@
 
     private Date getDateFromDiskDescription(Map<String, Object> map) {
         try {
-            return new 
SimpleDateFormat(OvfParser.formatStrFromDiskDescription).parse(map.get(OvfInfoFileConstants.LastUpdated)
-                    .toString());
+            if (map.get(OvfInfoFileConstants.LastUpdated) != null) {
+                return new 
SimpleDateFormat(OvfParser.formatStrFromDiskDescription).parse(map.get(OvfInfoFileConstants.LastUpdated)
+                        .toString());
+            } else {
+                log.info("LastUpdate Date is not initialized in the OVF_STORE 
disk.");
+            }
         } catch (java.text.ParseException e) {
             log.errorFormat("LastUpdate Date could not be parsed from disk 
desscription. Exception: {0}", e);
-            return null;
         }
+        return null;
     }
 
     private boolean isDomainExistsInDiskDescription(Map<String, Object> map, 
Guid storageDomainId) {


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

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

Reply via email to