Author: mbrohl
Date: Wed May 24 12:31:38 2017
New Revision: 1796049
URL: http://svn.apache.org/viewvc?rev=1796049&view=rev
Log:
Applied fix from trunk for revision: 1796047
===
Fixed: Fix TemporalExpressions.Frequency to avoid moving job start times away
from given freqCount raster.
(OFBIZ-9374)
If a job is scheduled using TemporalExpressions.Frequency the start time of the
job will gradually move forward when the excecution of the job is delayed by
one
or more units of the frequency type.
Example: Job is set up to start at 2017-01-01 00:00:00 and run every ten
minutes. One month later due to some circumstances the job starts at
2017-02-01 00:01:01 which results in the next execution to be scheduled at
2017-02-01 01:11:00 in stead of 2017-02-01 01:10:00.
The reason behind this behaviour is the
TemporalExpressions.Frequency#prepareCal
function. It has the purpose to jump from the first starting time to the latest
possible execution of the job. But instead it just sets it to the current time
(with the precision of the chosen frequency type) and calculates the next
execution time from this point.
Thanks: Tobias Laufkötter for reporting and providing the patch.
Modified:
ofbiz/branches/release16.11/ (props changed)
ofbiz/branches/release16.11/framework/service/src/main/java/org/apache/ofbiz/service/calendar/TemporalExpressions.java
Propchange: ofbiz/branches/release16.11/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed May 24 12:31:38 2017
@@ -10,5 +10,5 @@
/ofbiz/branches/json-integration-refactoring:1634077-1635900
/ofbiz/branches/multitenant20100310:921280-927264
/ofbiz/branches/release13.07:1547657
-/ofbiz/ofbiz-framework/trunk:1783202,1783388,1784549,1784558,1784708,1785882,1785925,1786079,1786214,1786525,1787047,1787133,1787176,1787535,1787906-1787911,1787949,1789665,1789863,1789874,1790396,1790810,1791277,1791288,1791342,1791346,1791490,1791496,1791625,1791634,1791791,1791804,1792270,1792272,1792275,1792432,1792609,1792638,1794008,1794132
+/ofbiz/ofbiz-framework/trunk:1783202,1783388,1784549,1784558,1784708,1785882,1785925,1786079,1786214,1786525,1787047,1787133,1787176,1787535,1787906-1787911,1787949,1789665,1789863,1789874,1790396,1790810,1791277,1791288,1791342,1791346,1791490,1791496,1791625,1791634,1791791,1791804,1792270,1792272,1792275,1792432,1792609,1792638,1794008,1794132,1796047
/ofbiz/trunk:1770481,1770490,1770540,1771440,1771448,1771516,1771935,1772346,1772880,1774772,1775441,1779724,1780659,1781109,1781125,1781979,1782498,1782520
Modified:
ofbiz/branches/release16.11/framework/service/src/main/java/org/apache/ofbiz/service/calendar/TemporalExpressions.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release16.11/framework/service/src/main/java/org/apache/ofbiz/service/calendar/TemporalExpressions.java?rev=1796049&r1=1796048&r2=1796049&view=diff
==============================================================================
---
ofbiz/branches/release16.11/framework/service/src/main/java/org/apache/ofbiz/service/calendar/TemporalExpressions.java
(original)
+++
ofbiz/branches/release16.11/framework/service/src/main/java/org/apache/ofbiz/service/calendar/TemporalExpressions.java
Wed May 24 12:31:38 2017
@@ -710,8 +710,8 @@ public class TemporalExpressions impleme
} else {
return skip;
}
- float units = deltaMillis / divisor;
- units = (units / this.freqCount) * this.freqCount;
+ long units = deltaMillis / divisor;
+ units -= units % this.freqCount;
skip.add(this.freqType, (int)units);
while (skip.after(cal)) {
skip.add(this.freqType, -this.freqCount);