Kun Liu created OOZIE-2865:
------------------------------
Summary: The resolveInstanceRange method throws unexpected
CommandException
Key: OOZIE-2865
URL: https://issues.apache.org/jira/browse/OOZIE-2865
Project: Oozie
Issue Type: Bug
Affects Versions: 4.3.0
Reporter: Kun Liu
When the resolveInstanceRange method of CoordCommandUtils.java resolves the
instance with 'coord:offset' function, it checks the start-instance and the
end-instance by condition statement: startU.getCalendarUnit() * startIndex >
endU.getCalendarUnit() * endIndex. The 'startU' and 'endU' are TimeUnit
objects.
If the CalendarUnit of startU was Calendar.MONTH and the CalendarUnit of endU
was Calendar.DATE, and we set both startIndex and endIndex to -1, then we got
startU.getCalendarUnit() * startIndex = 2 * -1 = -2 , endU.getCalendarUnit() *
endIndex = 5 * -1 = -5, thus the condition statement 'startU.getCalendarUnit()
* startIndex > endU.getCalendarUnit() * endIndex' is true, and the
CommandException is thrown. However, the start-instance was earlier than the
end-instance indeed.
The reason was that the larger time unit is represented by a smaller integer in
Calendar.java, thus when we set the startIndex and endIndex to a negative
number, the unexpected exception is thrown.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)