IDEMPIERE-455 Discover and fix FindBugs problems / Pattern LSYC_LOCAL_SYNCHRONIZED

This commit is contained in:
Carlos Ruiz 2012-12-13 18:12:17 -05:00
parent 024c8d35c9
commit f102760447
1 changed files with 5 additions and 8 deletions

View File

@ -19,8 +19,8 @@ package org.compiere.model;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
@ -133,8 +133,7 @@ public class MTemplate extends X_CM_Template
{ {
StringBuffer subTemplates = new StringBuffer (); StringBuffer subTemplates = new StringBuffer ();
int pos = 0; int pos = 0;
// JJ: if you don't use the value, could you use ArrayList ? ArrayList<String> subTemplateNames = new ArrayList<String> ();
Hashtable<String, String> subTemplateNames = new Hashtable<String, String> ();
while (m_preBuildTemplate.indexOf ("<xsl:call-template", pos) >= 0) while (m_preBuildTemplate.indexOf ("<xsl:call-template", pos) >= 0)
{ {
String thisName = null; String thisName = null;
@ -154,14 +153,12 @@ public class MTemplate extends X_CM_Template
thisName = tempTemplate.substring (tempTemplate thisName = tempTemplate.substring (tempTemplate
.indexOf ("name=\"") + 6, tempTemplate.indexOf ( .indexOf ("name=\"") + 6, tempTemplate.indexOf (
"\"", tempTemplate.indexOf ("name=\"") + 7)); "\"", tempTemplate.indexOf ("name=\"") + 7));
if (!subTemplateNames.containsKey (thisName)) if (!subTemplateNames.contains(thisName))
subTemplateNames.put (thisName, "0"); subTemplateNames.add(thisName);
} }
} }
Enumeration<String> thisEnum = subTemplateNames.keys (); for (String thisElement : subTemplateNames)
while (thisEnum.hasMoreElements ())
{ {
String thisElement = thisEnum.nextElement ().toString ();
int[] templateIDs = MTemplate.getAllIDs ("CM_Template", int[] templateIDs = MTemplate.getAllIDs ("CM_Template",
"Value LIKE '" + thisElement "Value LIKE '" + thisElement
+ "' AND CM_WebProject_ID=" + "' AND CM_WebProject_ID="