From 75628911f260bea88eaa49aa6c5baf1551b3ebe4 Mon Sep 17 00:00:00 2001 From: Richard Morales Date: Wed, 5 Dec 2012 17:27:35 -0500 Subject: [PATCH] IDEMPIERE-308 Performance: Replace use of StringBuffer and String concatenation with StringBuilder / findbugs fb-contrib pattern LSYC_LOCAL_SYNCHRONIZED_COLLECTION --- org.adempiere.base/src/org/compiere/model/MStorageOnHand.java | 2 +- .../src/org/compiere/model/MStorageReservation.java | 2 +- .../src/org/idempiere/fitnesse/fixture/CreateRecord.java | 2 +- .../src/org/idempiere/fitnesse/fixture/SetDocAction.java | 2 +- .../src/org/idempiere/fitnesse/fixture/Util.java | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java b/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java index 2fae555823..5e7eacf69a 100644 --- a/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java +++ b/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java @@ -576,7 +576,7 @@ public class MStorageOnHand extends X_M_StorageOnHand * @return */ 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)") .append(" WHERE oh.M_Product_ID=?") .append(" AND loc.M_Warehouse_ID=?"); diff --git a/org.adempiere.base/src/org/compiere/model/MStorageReservation.java b/org.adempiere.base/src/org/compiere/model/MStorageReservation.java index ad6178caa8..318800303f 100644 --- a/org.adempiere.base/src/org/compiere/model/MStorageReservation.java +++ b/org.adempiere.base/src/org/compiere/model/MStorageReservation.java @@ -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) { ArrayList params = new ArrayList(); - StringBuffer sql = new StringBuffer(); + StringBuilder sql = new StringBuilder(); sql.append(" SELECT SUM(Qty) FROM M_StorageReservation sr") .append(" WHERE sr.M_Product_ID=? AND sr.M_Warehouse_ID=?") .append(" AND sr.IsSOTrx=?"); diff --git a/org.idempiere.fitnesse.fixture/src/org/idempiere/fitnesse/fixture/CreateRecord.java b/org.idempiere.fitnesse.fixture/src/org/idempiere/fitnesse/fixture/CreateRecord.java index d72c991d90..807ce0435a 100644 --- a/org.idempiere.fitnesse.fixture/src/org/idempiere/fitnesse/fixture/CreateRecord.java +++ b/org.idempiere.fitnesse.fixture/src/org/idempiere/fitnesse/fixture/CreateRecord.java @@ -97,7 +97,7 @@ public class CreateRecord extends TableFixture { } else { if (columnsOK) { if (!gpo.save()) { - StringBuffer msg = new StringBuffer(); + StringBuilder msg = new StringBuilder(); Exception e = (Exception) ctx.get("org.compiere.util.CLogger.lastException"); if (e != null) msg.append("Exception: "+ e.getMessage()); diff --git a/org.idempiere.fitnesse.fixture/src/org/idempiere/fitnesse/fixture/SetDocAction.java b/org.idempiere.fitnesse.fixture/src/org/idempiere/fitnesse/fixture/SetDocAction.java index 23c160661f..117f975ff7 100644 --- a/org.idempiere.fitnesse.fixture/src/org/idempiere/fitnesse/fixture/SetDocAction.java +++ b/org.idempiere.fitnesse.fixture/src/org/idempiere/fitnesse/fixture/SetDocAction.java @@ -106,7 +106,7 @@ public class SetDocAction extends TableFixture { DocumentEngine engine = new DocumentEngine ((DocAction) gpo, ((DocAction)gpo).getDocStatus()); 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()) .append(" valid actions are:"); for (String s : engine.getActionOptions()) diff --git a/org.idempiere.fitnesse.fixture/src/org/idempiere/fitnesse/fixture/Util.java b/org.idempiere.fitnesse.fixture/src/org/idempiere/fitnesse/fixture/Util.java index f1c43b9ced..e233354b6a 100644 --- a/org.idempiere.fitnesse.fixture/src/org/idempiere/fitnesse/fixture/Util.java +++ b/org.idempiere.fitnesse.fixture/src/org/idempiere/fitnesse/fixture/Util.java @@ -164,7 +164,7 @@ public class Util { } } } - StringBuffer randomstr = new StringBuffer(); + StringBuilder randomstr = new StringBuilder(); if (prefix != null && prefix.length() > 0) randomstr.append(prefix); for (int i = 0; i < length; i++) { @@ -206,7 +206,7 @@ public class Util { String token; String inStr = new String(value); - StringBuffer outStr = new StringBuffer(); + StringBuilder outStr = new StringBuilder(); int i = inStr.indexOf('@'); while (i != -1)