IDEMPIERE-4099 Language.getDateFormat() is not thread safe

This commit is contained in:
Heng Sin Low 2019-11-13 10:19:39 +08:00
parent f46b8afb5c
commit be3e7958eb
1 changed files with 3 additions and 3 deletions

View File

@ -479,7 +479,7 @@ public class Language implements Serializable
* using the upper case function. * using the upper case function.
* It also must have leading zero for day and month. * It also must have leading zero for day and month.
*/ */
public void setDateFormat (String javaDatePattern) public synchronized void setDateFormat (String javaDatePattern)
{ {
if (javaDatePattern == null) if (javaDatePattern == null)
return; return;
@ -502,7 +502,7 @@ public class Language implements Serializable
* i.e. leading zero for date and month * i.e. leading zero for date and month
* @return date format MM/dd/yyyy - dd.MM.yyyy * @return date format MM/dd/yyyy - dd.MM.yyyy
*/ */
public SimpleDateFormat getDateFormat() public synchronized SimpleDateFormat getDateFormat()
{ {
if (m_dateFormat == null) if (m_dateFormat == null)
{ {
@ -537,7 +537,7 @@ public class Language implements Serializable
} }
m_dateFormat.setLenient(true); m_dateFormat.setLenient(true);
} }
return m_dateFormat; return (SimpleDateFormat) m_dateFormat.clone();
} // getDateFormat } // getDateFormat
/** /**