Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2008-10-14 21:23:19 -0400
committerspingel2008-10-14 21:23:19 -0400
commit3cc6731fe7f05f3696a6f4efae4bd7fad3cf23bd (patch)
tree7a69ee806dc000dcef0de6b68ad3033c3d768249
parent9b3d1c84fdbaa61882dd8f932cecfdd116a87171 (diff)
downloadorg.eclipse.mylyn.tasks-3cc6731fe7f05f3696a6f4efae4bd7fad3cf23bd.tar.gz
org.eclipse.mylyn.tasks-3cc6731fe7f05f3696a6f4efae4bd7fad3cf23bd.tar.xz
org.eclipse.mylyn.tasks-3cc6731fe7f05f3696a6f4efae4bd7fad3cf23bd.zip
248683: NPE in DateRange.isWeekAfterNext()
https://bugs.eclipse.org/bugs/show_bug.cgi?id=248683
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DayDateRange.java4
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WeekDateRange.java4
2 files changed, 6 insertions, 2 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DayDateRange.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DayDateRange.java
index 0112a5fb3..6ad489dab 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DayDateRange.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DayDateRange.java
@@ -79,6 +79,8 @@ public class DayDateRange extends DateRange {
}
public static boolean isDayRange(Calendar calStart, Calendar calEnd) {
- return ((calEnd.getTimeInMillis() - calStart.getTimeInMillis()) == DAY - 1);
+ // bug 248683
+ long diff = (calEnd.getTimeInMillis() - calStart.getTimeInMillis()) - (DAY - 1);
+ return Math.abs(diff) <= 60 * 60 * 1000;
}
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WeekDateRange.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WeekDateRange.java
index 331bceb77..8856a1c81 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WeekDateRange.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WeekDateRange.java
@@ -161,6 +161,8 @@ public class WeekDateRange extends DateRange {
}
public static boolean isWeekRange(Calendar calStart, Calendar calEnd) {
- return ((calEnd.getTimeInMillis() - calStart.getTimeInMillis()) == (DAY * 7) - 1);
+ // bug 248683
+ long diff = (calEnd.getTimeInMillis() - calStart.getTimeInMillis()) - (DAY * 7 - 1);
+ return Math.abs(diff) <= 60 * 60 * 1000;
}
}

Back to the top