Author: adrianc
Date: Wed Jan  6 19:46:18 2010
New Revision: 896642

URL: http://svn.apache.org/viewvc?rev=896642&view=rev
Log:
Fixed a bug in TemporalExpressions.Union where the next(Calendar cal) method 
returned the next date found in the union, not the next chronological date.

Modified:
    
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java

Modified: 
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java?rev=896642&r1=896641&r2=896642&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java
 (original)
+++ 
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java
 Wed Jan  6 19:46:18 2010
@@ -121,12 +121,16 @@
 
         @Override
         public Calendar next(Calendar cal) {
+            Set<Calendar> resultSet = new TreeSet<Calendar>();
             for (TemporalExpression expression : this.expressionSet) {
                 Calendar next = expression.next(cal);
                 if (next != null && includesDate(next)) {
-                    return next;
+                    resultSet.add(next);
                 }
             }
+            if (!resultSet.isEmpty()) {
+                return resultSet.iterator().next();
+            }
             return null;
         }
 


Reply via email to