From 5f231ec0051cff40a635e2b943d60c550e828033 Mon Sep 17 00:00:00 2001 From: Adrian Crum Date: Sun, 28 Dec 2014 00:58:44 +0000 Subject: [PATCH] Fixed a NPE I introduced in rev 1647606. Reported by Pierre Smits on dev mailing list. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1648139 13f79535-47bb-0310-9956-ffa450edef68 --- framework/base/src/org/ofbiz/base/util/UtilDateTime.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/base/src/org/ofbiz/base/util/UtilDateTime.java b/framework/base/src/org/ofbiz/base/util/UtilDateTime.java index fd0827ae12..96fe317aec 100644 --- a/framework/base/src/org/ofbiz/base/util/UtilDateTime.java +++ b/framework/base/src/org/ofbiz/base/util/UtilDateTime.java @@ -972,7 +972,7 @@ public class UtilDateTime { if (UtilValidate.isEmpty(dateFormat)) { df = DateFormat.getDateInstance(DateFormat.SHORT, locale); } else { - df = new SimpleDateFormat(dateFormat, locale); + df = new SimpleDateFormat(dateFormat, locale == null ? Locale.getDefault() : locale); } df.setTimeZone(tz); return df; @@ -990,7 +990,7 @@ public class UtilDateTime { if (UtilValidate.isEmpty(dateTimeFormat)) { df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, locale); } else { - df = new SimpleDateFormat(dateTimeFormat, locale); + df = new SimpleDateFormat(dateTimeFormat, locale == null ? Locale.getDefault() : locale); } df.setTimeZone(tz); return df; @@ -1008,7 +1008,7 @@ public class UtilDateTime { if (UtilValidate.isEmpty(timeFormat)) { df = DateFormat.getTimeInstance(DateFormat.MEDIUM, locale); } else { - df = new SimpleDateFormat(timeFormat, locale); + df = new SimpleDateFormat(timeFormat, locale == null ? Locale.getDefault() : locale); } df.setTimeZone(tz); return df;