mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-13 21:13:19 +00:00
[DS-707] Fix threaded handling of DateFormatSymbols
git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5480 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -42,11 +42,7 @@ import java.text.DateFormatSymbols;
|
|||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Calendar;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.GregorianCalendar;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.TimeZone;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
@@ -111,17 +107,7 @@ public class DCDate
|
|||||||
// just year, "2009"
|
// just year, "2009"
|
||||||
private final SimpleDateFormat yearIso = new SimpleDateFormat("yyyy");
|
private final SimpleDateFormat yearIso = new SimpleDateFormat("yyyy");
|
||||||
|
|
||||||
|
private static Map<Locale, DateFormatSymbols> dfsLocaleMap = new HashMap<Locale, DateFormatSymbols>();
|
||||||
/**
|
|
||||||
* DateFormatSymbols for locale months name
|
|
||||||
*/
|
|
||||||
private static DateFormatSymbols dfs = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* note the session locale
|
|
||||||
*/
|
|
||||||
private static Locale langMonth = null;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a date object from a Java <code>Date</code> object.
|
* Construct a date object from a Java <code>Date</code> object.
|
||||||
@@ -640,11 +626,13 @@ public class DCDate
|
|||||||
{
|
{
|
||||||
if ((m > 0) && (m < 13))
|
if ((m > 0) && (m < 13))
|
||||||
{
|
{
|
||||||
if (dfs == null || !langMonth.equals(locale))
|
DateFormatSymbols dfs = dfsLocaleMap.get(locale);
|
||||||
{
|
if (dfs == null)
|
||||||
dfs = new DateFormatSymbols(locale);
|
{
|
||||||
langMonth = locale;
|
dfs = new DateFormatSymbols(locale);
|
||||||
}
|
dfsLocaleMap.put(locale, dfs);
|
||||||
|
}
|
||||||
|
|
||||||
return dfs.getMonths()[m-1];
|
return dfs.getMonths()[m-1];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user