Martin Betak has uploaded a new change for review.

Change subject: backend: Remove duplicate read of TimeZone in OvfVmReader
......................................................................

backend: Remove duplicate read of TimeZone in OvfVmReader

Removed duplicate read of TimeZone ovf-field which was not sanitized
against empty strings causing creation of Vm with invalid timezone
"" (correctly should be normalized to null).

Also removed the temporary fix in TimeZoneValidator since now all cases
should be covered and the empty string time-zone always normalized to
null.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1015049
Change-Id: I9152bc347a5358ca794ee8c237e4486f444862ee
Signed-off-by: Martin Betak <[email protected]>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/validation/TimeZoneValidator.java
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmReader.java
2 files changed, 1 insertion(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/87/19987/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/validation/TimeZoneValidator.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/validation/TimeZoneValidator.java
index 67ca97d..29cd69d 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/validation/TimeZoneValidator.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/validation/TimeZoneValidator.java
@@ -19,7 +19,7 @@
 
     @Override
     public boolean isValid(VmBase value, ConstraintValidatorContext context) {
-        if (value.getTimeZone() == null || 
"".equals(value.getTimeZone().trim())) {
+        if (value.getTimeZone() == null) {
             return true;
         }
         TimeZoneType timeZoneType = osRepository.isWindows(value.getOsId()) ? 
TimeZoneType.WINDOWS_TIMEZONE : TimeZoneType.GENERAL_TIMEZONE;
diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmReader.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmReader.java
index f23de6b..e626500 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmReader.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmReader.java
@@ -164,10 +164,6 @@
         if (node != null) {
             
_vm.getStaticData().setInitialized(Boolean.parseBoolean(node.InnerText));
         }
-        node = content.SelectSingleNode("TimeZone");
-        if (node != null) {
-            _vm.getStaticData().setTimeZone(node.InnerText);
-        }
         node = content.SelectSingleNode("quota_id");
         if (node != null) {
             _vm.getStaticData().setQuotaId(new Guid(node.InnerText));


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

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

Reply via email to