IDEMPIERE-308 Performance: Replace use of StringBuffer and String concatenation with StringBuilder / findbugs fb-contrib pattern LSYC_LOCAL_SYNCHRONIZED_COLLECTION

This commit is contained in:
Richard Morales 2012-12-05 17:27:35 -05:00
parent 3109d2584e
commit 75628911f2
5 changed files with 6 additions and 6 deletions

View File

@ -576,7 +576,7 @@ public class MStorageOnHand extends X_M_StorageOnHand
* @return * @return
*/ */
public static BigDecimal getQtyOnHand(int M_Product_ID, int M_Warehouse_ID, int M_AttributeSetInstance_ID, String trxName) { public static BigDecimal getQtyOnHand(int M_Product_ID, int M_Warehouse_ID, int M_AttributeSetInstance_ID, String trxName) {
StringBuffer sql = new StringBuffer(); StringBuilder sql = new StringBuilder();
sql.append(" SELECT SUM(QtyOnHand) FROM M_StorageOnHand oh JOIN M_Locator loc ON (oh.M_Locator_ID=loc.M_Locator_ID)") sql.append(" SELECT SUM(QtyOnHand) FROM M_StorageOnHand oh JOIN M_Locator loc ON (oh.M_Locator_ID=loc.M_Locator_ID)")
.append(" WHERE oh.M_Product_ID=?") .append(" WHERE oh.M_Product_ID=?")
.append(" AND loc.M_Warehouse_ID=?"); .append(" AND loc.M_Warehouse_ID=?");

View File

@ -167,7 +167,7 @@ public class MStorageReservation extends X_M_StorageReservation {
*/ */
private static BigDecimal getQty(int M_Product_ID, int M_Warehouse_ID, int M_AttributeSetInstance_ID, boolean isSOTrx, String trxName) { private static BigDecimal getQty(int M_Product_ID, int M_Warehouse_ID, int M_AttributeSetInstance_ID, boolean isSOTrx, String trxName) {
ArrayList<Object> params = new ArrayList<Object>(); ArrayList<Object> params = new ArrayList<Object>();
StringBuffer sql = new StringBuffer(); StringBuilder sql = new StringBuilder();
sql.append(" SELECT SUM(Qty) FROM M_StorageReservation sr") sql.append(" SELECT SUM(Qty) FROM M_StorageReservation sr")
.append(" WHERE sr.M_Product_ID=? AND sr.M_Warehouse_ID=?") .append(" WHERE sr.M_Product_ID=? AND sr.M_Warehouse_ID=?")
.append(" AND sr.IsSOTrx=?"); .append(" AND sr.IsSOTrx=?");

View File

@ -97,7 +97,7 @@ public class CreateRecord extends TableFixture {
} else { } else {
if (columnsOK) { if (columnsOK) {
if (!gpo.save()) { if (!gpo.save()) {
StringBuffer msg = new StringBuffer(); StringBuilder msg = new StringBuilder();
Exception e = (Exception) ctx.get("org.compiere.util.CLogger.lastException"); Exception e = (Exception) ctx.get("org.compiere.util.CLogger.lastException");
if (e != null) if (e != null)
msg.append("Exception: "+ e.getMessage()); msg.append("Exception: "+ e.getMessage());

View File

@ -106,7 +106,7 @@ public class SetDocAction extends TableFixture {
DocumentEngine engine = new DocumentEngine ((DocAction) gpo, ((DocAction)gpo).getDocStatus()); DocumentEngine engine = new DocumentEngine ((DocAction) gpo, ((DocAction)gpo).getDocStatus());
if (! engine.isValidAction(docAction)) { if (! engine.isValidAction(docAction)) {
StringBuffer msg = new StringBuffer("Not a valid action for docStatus="); StringBuilder msg = new StringBuilder("Not a valid action for docStatus=");
msg.append(((DocAction)gpo).getDocStatus()) msg.append(((DocAction)gpo).getDocStatus())
.append(" valid actions are:"); .append(" valid actions are:");
for (String s : engine.getActionOptions()) for (String s : engine.getActionOptions())

View File

@ -164,7 +164,7 @@ public class Util {
} }
} }
} }
StringBuffer randomstr = new StringBuffer(); StringBuilder randomstr = new StringBuilder();
if (prefix != null && prefix.length() > 0) if (prefix != null && prefix.length() > 0)
randomstr.append(prefix); randomstr.append(prefix);
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
@ -206,7 +206,7 @@ public class Util {
String token; String token;
String inStr = new String(value); String inStr = new String(value);
StringBuffer outStr = new StringBuffer(); StringBuilder outStr = new StringBuilder();
int i = inStr.indexOf('@'); int i = inStr.indexOf('@');
while (i != -1) while (i != -1)