From d4fa24f6a6f1e3bfd07ed8077bb5b88f6c19a2d1 Mon Sep 17 00:00:00 2001 From: Hans Bakker Date: Thu, 24 Nov 2011 02:54:14 +0000 Subject: [PATCH] getDayEnd will have a null pointer exception when the offset is not provided. This can cause very strange behaviour in the system when people forget to enter a value in terms. When not provided zero is assumed now git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1205710 13f79535-47bb-0310-9956-ffa450edef68 --- framework/base/src/org/ofbiz/base/util/UtilDateTime.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/framework/base/src/org/ofbiz/base/util/UtilDateTime.java b/framework/base/src/org/ofbiz/base/util/UtilDateTime.java index ede2c0db00..5ffd8e2f85 100644 --- a/framework/base/src/org/ofbiz/base/util/UtilDateTime.java +++ b/framework/base/src/org/ofbiz/base/util/UtilDateTime.java @@ -823,6 +823,9 @@ public class UtilDateTime { } public static Timestamp getDayEnd(Timestamp stamp, Long daysLater, TimeZone timeZone, Locale locale) { + if (daysLater == null) { + daysLater = Long.valueOf(0); + } Calendar tempCal = toCalendar(stamp, timeZone, locale); tempCal.set(tempCal.get(Calendar.YEAR), tempCal.get(Calendar.MONTH), tempCal.get(Calendar.DAY_OF_MONTH), 23, 59, 59); tempCal.add(Calendar.DAY_OF_MONTH, daysLater.intValue());