IDEMPIERE-136 Tenant base language improvement / make it thread safe (thanks to Heng Sin for raising the alert) and include other suggestions from findbugs

This commit is contained in:
Carlos Ruiz 2013-03-28 10:28:22 -05:00
parent 96dbdd2cf0
commit 466f5f6cae
2 changed files with 10 additions and 10 deletions

View File

@ -67,7 +67,7 @@ public class MTable extends X_AD_Table
*/ */
public static MTable get (Properties ctx, int AD_Table_ID) public static MTable get (Properties ctx, int AD_Table_ID)
{ {
Integer key = new Integer (AD_Table_ID); Integer key = Integer.valueOf(AD_Table_ID);
MTable retValue = s_cache.get (key); MTable retValue = s_cache.get (key);
if (retValue != null && retValue.getCtx() == ctx) { if (retValue != null && retValue.getCtx() == ctx) {
return retValue; return retValue;
@ -125,7 +125,7 @@ public class MTable extends X_AD_Table
if (retValue != null) if (retValue != null)
{ {
Integer key = new Integer (retValue.getAD_Table_ID()); Integer key = Integer.valueOf(retValue.getAD_Table_ID());
s_cache.put (key, retValue); s_cache.put (key, retValue);
} }
return retValue; return retValue;
@ -216,7 +216,7 @@ public class MTable extends X_AD_Table
* @param requery requery * @param requery requery
* @return array of columns * @return array of columns
*/ */
public MColumn[] getColumns (boolean requery) public synchronized MColumn[] getColumns (boolean requery)
{ {
if (m_columns != null && !requery) if (m_columns != null && !requery)
return m_columns; return m_columns;
@ -277,7 +277,7 @@ public class MTable extends X_AD_Table
* @param ColumnName column name * @param ColumnName column name
* @return index of column with ColumnName or -1 if not found * @return index of column with ColumnName or -1 if not found
*/ */
public int getColumnIndex (String ColumnName) public synchronized int getColumnIndex (String ColumnName)
{ {
if (m_columns == null) if (m_columns == null)
getColumns(false); getColumns(false);
@ -293,7 +293,7 @@ public class MTable extends X_AD_Table
* @param AD_Column_ID column * @param AD_Column_ID column
* @return index of column with ColumnName or -1 if not found * @return index of column with ColumnName or -1 if not found
*/ */
public int getColumnIndex (int AD_Column_ID) public synchronized int getColumnIndex (int AD_Column_ID)
{ {
if (m_columns == null) if (m_columns == null)
getColumns(false); getColumns(false);
@ -370,7 +370,7 @@ public class MTable extends X_AD_Table
if (po == null) if (po == null)
{ {
po = new GenericPO(tableName, getCtx(), new Integer(Record_ID), trxName); po = new GenericPO(tableName, getCtx(), Record_ID, trxName);
if (po.get_ID() != Record_ID && Record_ID > 0) if (po.get_ID() != Record_ID && Record_ID > 0)
po = null; po = null;
} }
@ -493,7 +493,7 @@ public class MTable extends X_AD_Table
MSequence seq = MSequence.get(getCtx(), getTableName(), get_TrxName()); MSequence seq = MSequence.get(getCtx(), getTableName(), get_TrxName());
if (seq == null || seq.get_ID() == 0) if (seq == null || seq.get_ID() == 0)
MSequence.createTableSequence(getCtx(), getTableName(), get_TrxName()); MSequence.createTableSequence(getCtx(), getTableName(), get_TrxName());
else if (seq != null && !seq.getName().equals(getTableName())) else if (!seq.getName().equals(getTableName()))
{ {
seq.setName(getTableName()); seq.setName(getTableName());
seq.saveEx(); seq.saveEx();

View File

@ -69,9 +69,9 @@ public class POInfo implements Serializable
* @param trxName Transaction name * @param trxName Transaction name
* @return POInfo * @return POInfo
*/ */
public static POInfo getPOInfo (Properties ctx, int AD_Table_ID, String trxName) public static synchronized POInfo getPOInfo (Properties ctx, int AD_Table_ID, String trxName)
{ {
Integer key = new Integer(AD_Table_ID); Integer key = Integer.valueOf(AD_Table_ID);
POInfo retValue = (POInfo)s_cache.get(key); POInfo retValue = (POInfo)s_cache.get(key);
if (retValue == null) if (retValue == null)
{ {
@ -577,7 +577,7 @@ public class POInfo implements Serializable
* Is Table Translated * Is Table Translated
* @return true if table is translated * @return true if table is translated
*/ */
public boolean isTranslated () public synchronized boolean isTranslated ()
{ {
if (m_IsTranslated == null) { if (m_IsTranslated == null) {
m_IsTranslated = Boolean.FALSE; m_IsTranslated = Boolean.FALSE;