Author: rohini
Date: Wed Oct 23 23:24:24 2013
New Revision: 1535212
URL: http://svn.apache.org/r1535212
Log:
OOZIE-1573 coord:tzOffset() gives incorrect offset for daylight saving
timezones (rohini)
Modified:
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/coord/CoordELFunctions.java
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/coord/TestCoordELFunctions.java
oozie/branches/branch-4.0/release-log.txt
Modified:
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/coord/CoordELFunctions.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/coord/CoordELFunctions.java?rev=1535212&r1=1535211&r2=1535212&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/coord/CoordELFunctions.java
(original)
+++
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/coord/CoordELFunctions.java
Wed Oct 23 23:24:24 2013
@@ -144,15 +144,10 @@ public class CoordELFunctions {
* @return difference in minutes (DataSet TZ Offset - Application TZ
offset)
*/
public static int ph2_coord_tzOffset() {
- Date actionCreationTime = getActionCreationtime();
+ long actionCreationTime = getActionCreationtime().getTime();
TimeZone dsTZ = ParamChecker.notNull(getDatasetTZ(), "DatasetTZ");
TimeZone jobTZ = ParamChecker.notNull(getJobTZ(), "JobTZ");
- // Apply the TZ into Calendar object
- Calendar dsTime = Calendar.getInstance(dsTZ);
- dsTime.setTime(actionCreationTime);
- Calendar jobTime = Calendar.getInstance(jobTZ);
- jobTime.setTime(actionCreationTime);
- return (dsTime.get(Calendar.ZONE_OFFSET) -
jobTime.get(Calendar.ZONE_OFFSET)) / (1000 * 60);
+ return (dsTZ.getOffset(actionCreationTime) -
jobTZ.getOffset(actionCreationTime)) / (1000 * 60);
}
public static int ph3_coord_tzOffset() {
Modified:
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/coord/TestCoordELFunctions.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/coord/TestCoordELFunctions.java?rev=1535212&r1=1535211&r2=1535212&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/coord/TestCoordELFunctions.java
(original)
+++
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/coord/TestCoordELFunctions.java
Wed Oct 23 23:24:24 2013
@@ -345,9 +345,17 @@ public class TestCoordELFunctions extend
// eval.setVariable("resolve_tzOffset", "true");
assertEquals("0", CoordELFunctions.evalAndWrap(eval, expr));
- appInst.setTimeZone(DateUtils.getTimeZone("America/New_York"));
+ appInst.setTimeZone(DateUtils.getTimeZone("UTC"));
+ ds.setTimeZone(DateUtils.getTimeZone("America/Los_Angeles"));
+
appInst.setNominalTime(DateUtils.parseDateOozieTZ("2012-06-13T00:00Z"));
//Summer
+ CoordELFunctions.configureEvaluator(eval, ds, appInst);
+ // PDT is UTC - 7
+ assertEquals("-420", CoordELFunctions.evalAndWrap(eval, expr));
+
+
appInst.setNominalTime(DateUtils.parseDateOozieTZ("2012-12-13T00:00Z"));
//Winter
CoordELFunctions.configureEvaluator(eval, ds, appInst);
- assertEquals("-180", CoordELFunctions.evalAndWrap(eval, expr));
+ // PST is UTC - 8
+ assertEquals("-480", CoordELFunctions.evalAndWrap(eval, expr));
}
public void testDateOffset() throws Exception {
Modified: oozie/branches/branch-4.0/release-log.txt
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/release-log.txt?rev=1535212&r1=1535211&r2=1535212&view=diff
==============================================================================
--- oozie/branches/branch-4.0/release-log.txt (original)
+++ oozie/branches/branch-4.0/release-log.txt Wed Oct 23 23:24:24 2013
@@ -1,5 +1,6 @@
-- Oozie 4.0.1 release (unreleased)
+OOZIE-1573 coord:tzOffset() gives incorrect offset for daylight saving
timezones (rohini)
OOZIE-1582 Bump up Tomcat version to 6.0.37 (rkanter)
OOZIE-1563 colt jar includes GPL licence (rkanter)
OOZIE-1284 oozie.service.SchemaService.wf.ext.schemas in oozie-site is missing
some newer xsd files (rkanter)