IDEMPIERE-455 Discover and fix FindBugs problems / Pattern: PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS

This commit is contained in:
Richard Morales 2012-12-05 16:44:51 -05:00
parent a5a198f358
commit f8a4523e49
8 changed files with 20 additions and 16 deletions

View File

@ -871,8 +871,9 @@ public class CConnection implements Serializable, Cloneable
// System.out.println ("CConnection.setDataSource - " + m_ds + " - Client=" + Ini.isClient());
if (m_ds == null && Ini.isClient())
{
if (getDatabase() != null) // no db selected
m_ds = getDatabase().getDataSource(this);
AdempiereDatabase getDB = getDatabase();
if (getDB != null) // no db selected
m_ds = getDB.getDataSource(this);
// System.out.println ("CConnection.setDataSource - " + m_ds);
}
return m_ds != null;

View File

@ -494,9 +494,9 @@ public class MInvoiceLine extends X_C_InvoiceLine
+ taxThisAmt + " Standard Tax Amt: " + taxStdAmt + " Line Net Amt: " + bd);
}
}
if (bd.scale() > getPrecision())
bd = bd.setScale(getPrecision(), BigDecimal.ROUND_HALF_UP);
int precision = getPrecision();
if (bd.scale() > precision)
bd = bd.setScale(precision, BigDecimal.ROUND_HALF_UP);
super.setLineNetAmt (bd);
} // setLineNetAmt
/**

View File

@ -404,9 +404,9 @@ public class MOrderLine extends X_C_OrderLine
}
}
if (bd.scale() > getPrecision())
bd = bd.setScale(getPrecision(), BigDecimal.ROUND_HALF_UP);
int precision = getPrecision();
if (bd.scale() > precision)
bd = bd.setScale(precision, BigDecimal.ROUND_HALF_UP);
super.setLineNetAmt (bd);
} // setLineNetAmt

View File

@ -400,7 +400,7 @@ public class MStore extends X_W_Store
try
{
String msg = email.send();
if (EMail.SENT_OK.equals (email.send ()))
if (EMail.SENT_OK.equals (msg))
{
log.info("Sent EMail " + subject + " to " + to);
return true;
@ -437,7 +437,7 @@ public class MStore extends X_W_Store
try
{
String msg = email.send();
if (EMail.SENT_OK.equals (email.send ()))
if (EMail.SENT_OK.equals (msg))
{
log.info("Sent Test EMail to " + getWStoreEMail());
return "OK";

View File

@ -186,8 +186,9 @@ public class ScheduleUtil
ResultSet rs = pstmt.executeQuery();
while (rs.next())
{
ma = new MAssignmentSlot (TimeUtil.getDay(rs.getTimestamp(2)),
TimeUtil.getNextDay(rs.getTimestamp(2)), // user entered date need to convert to not including end time
Timestamp date = rs.getTimestamp(2);
ma = new MAssignmentSlot (TimeUtil.getDay(date),
TimeUtil.getNextDay(date), // user entered date need to convert to not including end time
Msg.getMsg(m_ctx, "NonBusinessDay"), rs.getString(1),
MAssignmentSlot.STATUS_NonBusinessDay);
log.finer("- NonBusinessDay " + ma);

View File

@ -614,9 +614,10 @@ public class ConfigurationData
//
try
{
String admail = adminEMail.toString();
EMail email = new EMail (new Properties(),
mailServer.getHostName (),
adminEMail.toString (), adminEMail.toString(),
admail, admail,
"Adempiere Server Setup Test",
"Test: " + getProperties());
email.createAuthenticator (mailUser, mailPassword);

View File

@ -1179,8 +1179,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (!detailTab)
{
logger.info(e.getMessage());
String dbInfo = e.getMessage();
logger.info(dbInfo);
if (adTabbox.getSelectedGridTab() != null && adTabbox.getSelectedGridTab().isQueryActive())
dbInfo = "[ " + dbInfo + " ]";
breadCrumb.setStatusDB(dbInfo, e);

View File

@ -234,8 +234,9 @@ public class WSQLProcess extends ADForm implements EventListener<Event>
}
catch (SQLException e)
{
log.log(Level.SEVERE, "process statement: " + sql + " - " + e.toString());
result.append("===> ").append(e.toString());
String exception = e.toString();
log.log(Level.SEVERE, "process statement: " + sql + " - " + exception);
result.append("===> ").append(exception);
}
// Clean up