cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prachida...@apache.org
Subject git commit: updated refs/heads/4.2 to a00433f
Date Fri, 18 Oct 2013 23:58:34 GMT
Updated Branches:
  refs/heads/4.2 643ce4bb9 -> a00433ff2


CLOUDSTACK-4895: Management server fails to start because snapshot policy time zones have
day light savings

Changes:

-     Calendar throws IllegalArgumentException when the hour of the day happens to be skipped
due to DST changes.
-     Fix will ask Calendar to adjust the time accordingly and get the next closest time


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a00433ff
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a00433ff
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a00433ff

Branch: refs/heads/4.2
Commit: a00433ff233a7597a46153abb98de1818ca01e61
Parents: 643ce4b
Author: Prachi Damle <prachi.damle@citrix.com>
Authored: Fri Oct 18 16:16:28 2013 -0700
Committer: Prachi Damle <prachi@cloud.com>
Committed: Fri Oct 18 16:44:58 2013 -0700

----------------------------------------------------------------------
 utils/src/com/cloud/utils/DateUtil.java | 41 ++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a00433ff/utils/src/com/cloud/utils/DateUtil.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/DateUtil.java b/utils/src/com/cloud/utils/DateUtil.java
index af89046..a6f4866 100644
--- a/utils/src/com/cloud/utils/DateUtil.java
+++ b/utils/src/com/cloud/utils/DateUtil.java
@@ -148,7 +148,13 @@ public class DateUtil {
     		scheduleTime.set(Calendar.MINUTE, minutes);
     		scheduleTime.set(Calendar.SECOND, 0);
     		scheduleTime.set(Calendar.MILLISECOND, 0);
-    		execDate = scheduleTime.getTime();
+            try {
+                execDate = scheduleTime.getTime();
+            } catch (IllegalArgumentException ex) {
+                scheduleTime.setLenient(true);
+                execDate = scheduleTime.getTime();
+                scheduleTime.setLenient(false);
+            }
     		// XXX: !execDate.after(startDate) is strictly for testing. 
     		// During testing we use a test clock which runs much faster than the real clock
     		// So startDate and execDate will always be ahead in the future
@@ -168,7 +174,13 @@ public class DateUtil {
     		scheduleTime.set(Calendar.MINUTE, minutes);
     		scheduleTime.set(Calendar.SECOND, 0);
     		scheduleTime.set(Calendar.MILLISECOND, 0);
-    		execDate = scheduleTime.getTime();
+            try {
+                execDate = scheduleTime.getTime();
+            } catch (IllegalArgumentException ex) {
+                scheduleTime.setLenient(true);
+                execDate = scheduleTime.getTime();
+                scheduleTime.setLenient(false);
+            }
     		// XXX: !execDate.after(startDate) is strictly for testing. 
             // During testing we use a test clock which runs much faster than the real clock
             // So startDate and execDate will always be ahead in the future
@@ -189,7 +201,13 @@ public class DateUtil {
     		scheduleTime.set(Calendar.MINUTE, minutes);
     		scheduleTime.set(Calendar.SECOND, 0);
     		scheduleTime.set(Calendar.MILLISECOND, 0);
-    		execDate = scheduleTime.getTime();
+            try {
+                execDate = scheduleTime.getTime();
+            } catch (IllegalArgumentException ex) {
+                scheduleTime.setLenient(true);
+                execDate = scheduleTime.getTime();
+                scheduleTime.setLenient(false);
+            }
     		// XXX: !execDate.after(startDate) is strictly for testing. 
             // During testing we use a test clock which runs much faster than the real clock
             // So startDate and execDate will always be ahead in the future
@@ -213,7 +231,13 @@ public class DateUtil {
     		scheduleTime.set(Calendar.MINUTE, minutes);
     		scheduleTime.set(Calendar.SECOND, 0);
     		scheduleTime.set(Calendar.MILLISECOND, 0);
-    		execDate = scheduleTime.getTime();
+            try {
+                execDate = scheduleTime.getTime();
+            } catch (IllegalArgumentException ex) {
+                scheduleTime.setLenient(true);
+                execDate = scheduleTime.getTime();
+                scheduleTime.setLenient(false);
+            }
     		// XXX: !execDate.after(startDate) is strictly for testing. 
             // During testing we use a test clock which runs much faster than the real clock
             // So startDate and execDate will always be ahead in the future
@@ -226,7 +250,14 @@ public class DateUtil {
     		throw new CloudRuntimeException("Incorrect interval: "+type.toString());
     	}
 
-    	return scheduleTime.getTime();
+        try {
+            return scheduleTime.getTime();
+        } catch (IllegalArgumentException ex) {
+            scheduleTime.setLenient(true);
+            Date nextScheduledDate = scheduleTime.getTime();
+            scheduleTime.setLenient(false);
+            return nextScheduledDate;
+        }
     }
 
     public static long getTimeDifference(Date date1, Date date2){


Mime
View raw message