You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by tv...@apache.org on 2016/01/08 12:24:57 UTC
svn commit: r1723694 -
/turbine/core/trunk/src/java/org/apache/turbine/services/pull/util/DateFormatter.java
Author: tv
Date: Fri Jan 8 11:24:57 2016
New Revision: 1723694
URL: http://svn.apache.org/viewvc?rev=1723694&view=rev
Log:
Make thread safe
Modified:
turbine/core/trunk/src/java/org/apache/turbine/services/pull/util/DateFormatter.java
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/pull/util/DateFormatter.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/pull/util/DateFormatter.java?rev=1723694&r1=1723693&r2=1723694&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/pull/util/DateFormatter.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/pull/util/DateFormatter.java Fri Jan 8 11:24:57 2016
@@ -38,9 +38,6 @@ import org.apache.turbine.services.pull.
public class DateFormatter
implements ApplicationTool
{
- /** Used for formatting date objects */
- private final SimpleDateFormat sdf = new SimpleDateFormat();
-
/** Default date format */
private static final String DATE_FORMAT_DEFAULT = "MM/dd/yyyy";
@@ -105,6 +102,7 @@ public class DateFormatter
public String format(Date theDate, String dateFormatString)
{
String result = null;
+ SimpleDateFormat sdf = new SimpleDateFormat();
if (StringUtils.isEmpty(dateFormatString) || theDate == null)
{
@@ -112,10 +110,9 @@ public class DateFormatter
}
else
{
- this.sdf.applyPattern(dateFormatString);
- result = this.sdf.format(theDate);
+ sdf.applyPattern(dateFormatString);
+ result = sdf.format(theDate);
}
return result;
}
-
}