IDEMPIERE-308 Performance: Replace with StringBuilder / some classes revisited to make them safer against NPE

This commit is contained in:
Richard Morales 2012-10-12 18:10:46 -05:00
parent 655dec54b0
commit ff9384f32e
6 changed files with 12 additions and 12 deletions

View File

@ -249,7 +249,7 @@ public class ImmediateBankTransfer extends SvrProcess
MCash cash = createCash();
MCashLine cashLines[]= createCashLines(cash);
StringBuilder processMsg = new StringBuilder(cash.getDocumentNo());
StringBuilder processMsg = new StringBuilder().append(cash.getDocumentNo());
cash.setDocAction(p_docAction);
if (!cash.processIt(p_docAction))

View File

@ -90,7 +90,7 @@ public class ImportOrder extends SvrProcess
{
StringBuilder sql = null;
int no = 0;
String clientCheck = " AND AD_Client_ID=" + m_AD_Client_ID;
StringBuilder clientCheck = new StringBuilder(" AND AD_Client_ID=").append(m_AD_Client_ID);
// **** Prepare ****

View File

@ -77,7 +77,7 @@ public class ProjectPhaseGenOrder extends SvrProcess
{
MOrderLine ol = new MOrderLine(order);
ol.setLine(fromPhase.getSeqNo());
StringBuilder sb = new StringBuilder (fromPhase.getName());
StringBuilder sb = new StringBuilder ().append(fromPhase.getName());
if (fromPhase.getDescription() != null && fromPhase.getDescription().length() > 0)
sb.append(" - ").append(fromPhase.getDescription());
ol.setDescription(sb.toString());
@ -122,7 +122,7 @@ public class ProjectPhaseGenOrder extends SvrProcess
{
MOrderLine ol = new MOrderLine(order);
ol.setLine(tasks[i].getSeqNo());
StringBuilder sb = new StringBuilder (tasks[i].getName());
StringBuilder sb = new StringBuilder ().append(tasks[i].getName());
if (tasks[i].getDescription() != null && tasks[i].getDescription().length() > 0)
sb.append(" - ").append(tasks[i].getDescription());
ol.setDescription(sb.toString());

View File

@ -746,7 +746,7 @@ public class RequestEMailProcessor extends SvrProcess
String deliveryMessage = null;
if (content instanceof InputStream)
{
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
InputStream is = (InputStream)content;
int c;
while ((c = is.read()) != -1)

View File

@ -337,7 +337,7 @@ public class PromotionRule {
//optional promotion code filter
String promotionCode = (String)order.get_Value("PromotionCode");
StringBuffer sql = new StringBuffer();
StringBuilder sql = new StringBuilder();
sql.append(select)
.append(" WHERE")
.append(" (" + bpFilter + ")")

View File

@ -270,12 +270,12 @@ public class MDistribution extends X_GL_Distribution
*/
public String validate()
{
StringBuilder retValue = null;
String retValue = null;
getLines(true);
if (m_lines.length == 0)
retValue = new StringBuilder("@NoLines@");
retValue = "@NoLines@";
else if (getPercentTotal().compareTo(Env.ONEHUNDRED) != 0)
retValue = new StringBuilder("@PercentTotal@ <> 100");
retValue = "@PercentTotal@ <> 100";
else
{
// More then one line with 0
@ -286,8 +286,8 @@ public class MDistribution extends X_GL_Distribution
{
if (lineFound >= 0 && m_lines[i].getPercent().compareTo(Env.ZERO) == 0)
{
retValue = new StringBuilder("@Line@ ").append(lineFound)
.append(" + ").append(m_lines[i].getLine()).append(": == 0");
retValue = "@Line@ " + lineFound
+ " + " + m_lines[i].getLine() + ": == 0";
break;
}
lineFound = m_lines[i].getLine();
@ -296,7 +296,7 @@ public class MDistribution extends X_GL_Distribution
}
setIsValid (retValue == null);
return retValue.toString();
return retValue;
} // validate