IDEMPIERE-455 Discover and fix FindBugs problems / Thanks to Richard Morales

This commit is contained in:
Carlos Ruiz 2012-10-12 18:25:55 -05:00
parent ff9384f32e
commit d1df4c45c8
10 changed files with 20 additions and 20 deletions

View File

@ -92,7 +92,7 @@ public class TaxNotFoundException extends AdempiereException
return "?"; return "?";
} }
MLocation loc = MLocation.get(Env.getCtx(), C_Location_ID, null); MLocation loc = MLocation.get(Env.getCtx(), C_Location_ID, null);
if (loc == null | loc.get_ID() != C_Location_ID) if (loc == null || loc.get_ID() != C_Location_ID)
{ {
return "?"; return "?";
} }

View File

@ -442,7 +442,7 @@ public class MAsset extends X_A_Asset
MAssetGroupAcct assetgrpacct = new MAssetGroupAcct (getCtx(), rs, get_TrxName()); MAssetGroupAcct assetgrpacct = new MAssetGroupAcct (getCtx(), rs, get_TrxName());
MAssetAcct assetacct = new MAssetAcct (getCtx(), 0, get_TrxName()); MAssetAcct assetacct = new MAssetAcct (getCtx(), 0, get_TrxName());
isdepreciate = assetgrpacct.isProcessing(); isdepreciate = assetgrpacct.isProcessing();
if (isDepreciated()== true | isdepreciate == true) if (isDepreciated()== true || isdepreciate == true)
{ {
assetacct.setPostingType(assetgrpacct.getPostingType()); assetacct.setPostingType(assetgrpacct.getPostingType());
assetacct.setA_Split_Percent(assetgrpacct.getA_Split_Percent()); assetacct.setA_Split_Percent(assetgrpacct.getA_Split_Percent());
@ -454,7 +454,7 @@ public class MAsset extends X_A_Asset
assetacct.setA_Period_Start(1); assetacct.setA_Period_Start(1);
if (getUseLifeMonths() == 0 & getUseLifeYears() == 0){ if (getUseLifeMonths() == 0 && getUseLifeYears() == 0){
assetacct.setA_Period_End(assetgrpacct.getUseLifeMonths()); assetacct.setA_Period_End(assetgrpacct.getUseLifeMonths());
asset.setUseLifeYears(assetgrpacct.getUseLifeYears()); asset.setUseLifeYears(assetgrpacct.getUseLifeYears());
asset.setUseLifeMonths(assetgrpacct.getUseLifeMonths()); asset.setUseLifeMonths(assetgrpacct.getUseLifeMonths());
@ -541,7 +541,7 @@ public class MAsset extends X_A_Asset
if (DB.getSQLValue(get_TrxName(), sql2, asset.getA_Asset_ID(),assetgrpacct.getPostingType())== 0) if (DB.getSQLValue(get_TrxName(), sql2, asset.getA_Asset_ID(),assetgrpacct.getPostingType())== 0)
{ {
if (isDepreciated()== true | isdepreciate == true) if (isDepreciated()== true || isdepreciate == true)
{ {
X_A_Depreciation_Workfile assetwk = new X_A_Depreciation_Workfile (getCtx(), 0, get_TrxName()); X_A_Depreciation_Workfile assetwk = new X_A_Depreciation_Workfile (getCtx(), 0, get_TrxName());
assetwk.setA_Asset_ID(p_A_Asset_ID); assetwk.setA_Asset_ID(p_A_Asset_ID);

View File

@ -291,13 +291,13 @@ public class MWFProcess extends X_AD_WF_Process
// //
if (closedState == null) if (closedState == null)
closedState = activityWFState; closedState = activityWFState;
else if (!closedState.equals(activityState)) else if (!closedState.equals(activityState.getState()))
{ {
// Overwrite if terminated // Overwrite if terminated
if (WFSTATE_Terminated.equals(activityState)) if (activityState.isTerminated())
closedState = activityWFState; closedState = activityWFState;
// Overwrite if activity aborted and no other terminated // Overwrite if activity aborted and no other terminated
else if (WFSTATE_Aborted.equals(activityState) && !WFSTATE_Terminated.equals(closedState)) else if (activityState.isAborted() && !WFSTATE_Terminated.equals(closedState))
closedState = activityWFState; closedState = activityWFState;
} }
} }

View File

@ -420,7 +420,7 @@ public class ExportHelper {
whereClause.append(" AND ").append(embeddedFormat.getWhereClause()); whereClause.append(" AND ").append(embeddedFormat.getWhereClause());
} }
String columnName = ""; String columnName = "";
if(formatLine.getAD_Reference_ID()== DisplayType.Table | formatLine.getAD_Reference_ID()==DisplayType.Search) if(formatLine.getAD_Reference_ID()== DisplayType.Table || formatLine.getAD_Reference_ID()==DisplayType.Search)
{ {
MColumn column = MColumn.get(masterPO.getCtx(), formatLine.getAD_Column_ID()); MColumn column = MColumn.get(masterPO.getCtx(), formatLine.getAD_Column_ID());
columnName = column.getColumnName(); columnName = column.getColumnName();

View File

@ -1206,7 +1206,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
{ {
CTabbedPane tab = (CTabbedPane) e.getSource(); CTabbedPane tab = (CTabbedPane) e.getSource();
if(tab.getSelectedIndex() == 4 & warehouseTbl.getRowCount() > 0) if(tab.getSelectedIndex() == 4 && warehouseTbl.getRowCount() > 0)
{ {
// If no warehouse row is selected in the warehouse tab, use the first warehouse // If no warehouse row is selected in the warehouse tab, use the first warehouse
// row to prevent array index out of bounds. BF 3051361 // row to prevent array index out of bounds. BF 3051361

View File

@ -281,7 +281,7 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev
Integer C_BPartner_ID = null; Integer C_BPartner_ID = null;
if (fBPartner_ID.getDisplay() != "") if (!"".equals(fBPartner_ID.getDisplay()))
C_BPartner_ID = (Integer)fBPartner_ID.getValue(); C_BPartner_ID = (Integer)fBPartner_ID.getValue();
if (C_BPartner_ID != null) if (C_BPartner_ID != null)
@ -291,7 +291,7 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev
Integer M_Product_ID = null; Integer M_Product_ID = null;
if (fProduct_ID.getDisplay() != "") if (!"".equals(fProduct_ID.getDisplay()))
M_Product_ID = (Integer)fProduct_ID.getValue(); M_Product_ID = (Integer)fProduct_ID.getValue();
if (M_Product_ID != null) if (M_Product_ID != null)

View File

@ -318,10 +318,10 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
if (fName.getText().length() > 0) if (fName.getText().length() > 0)
sql.append(" AND UPPER(c.Name) LIKE ?"); sql.append(" AND UPPER(c.Name) LIKE ?");
if (fCashBook_ID.getDisplay() != "") if (!"".equals(fCashBook_ID.getDisplay()))
sql.append(" AND c.C_CashBook_ID=?"); sql.append(" AND c.C_CashBook_ID=?");
if (fInvoice_ID.getDisplay() != "") if (!"".equals(fInvoice_ID.getDisplay()))
sql.append(" AND cl.C_Invoice_ID=?"); sql.append(" AND cl.C_Invoice_ID=?");
if (fDateFrom.getValue() != null || fDateTo.getValue() != null) if (fDateFrom.getValue() != null || fDateTo.getValue() != null)

View File

@ -299,7 +299,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
if (fPOReference.getText().length() > 0) if (fPOReference.getText().length() > 0)
sql.append(" AND UPPER(i.POReference) LIKE ?"); sql.append(" AND UPPER(i.POReference) LIKE ?");
if (fBPartner_ID.getDisplay() != "") if (!"".equals(fBPartner_ID.getDisplay()))
sql.append(" AND i.C_BPartner_ID=?"); sql.append(" AND i.C_BPartner_ID=?");
if (fDateFrom.getValue() != null || fDateTo.getValue() != null) if (fDateFrom.getValue() != null || fDateTo.getValue() != null)
@ -343,7 +343,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
if (fPOReference.getText().length() > 0) if (fPOReference.getText().length() > 0)
pstmt.setString(index++, getSQLText(fPOReference)); pstmt.setString(index++, getSQLText(fPOReference));
if (fBPartner_ID.getDisplay() != "") if (!"".equals(fBPartner_ID.getDisplay()))
{ {
Integer bp = (Integer)fBPartner_ID.getValue(); Integer bp = (Integer)fBPartner_ID.getValue();
pstmt.setInt(index++, bp.intValue()); pstmt.setInt(index++, bp.intValue());

View File

@ -306,7 +306,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
if (fDocumentNo.getText().length() > 0) if (fDocumentNo.getText().length() > 0)
sql.append(" AND UPPER(p.DocumentNo) LIKE ?"); sql.append(" AND UPPER(p.DocumentNo) LIKE ?");
if (fBPartner_ID.getDisplay() != "") if (!"".equals(fBPartner_ID.getDisplay()))
sql.append(" AND p.C_BPartner_ID=?"); sql.append(" AND p.C_BPartner_ID=?");
if (fDateFrom.getValue() != null || fDateTo.getValue() != null) if (fDateFrom.getValue() != null || fDateTo.getValue() != null)
@ -331,7 +331,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
sql.append(" AND TRUNC(p.DateTrx) BETWEEN ? AND ?"); sql.append(" AND TRUNC(p.DateTrx) BETWEEN ? AND ?");
} }
if (fAmtFrom.getText() != "" || fAmtTo.getText() != "") if (!"".equals(fAmtFrom.getText()) || !"".equals(fAmtTo.getText()))
{ {
BigDecimal from = new BigDecimal(fAmtFrom.getValue()); BigDecimal from = new BigDecimal(fAmtFrom.getValue());
BigDecimal to = new BigDecimal(fAmtTo.getValue()); BigDecimal to = new BigDecimal(fAmtTo.getValue());
@ -365,7 +365,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
if (fDocumentNo.getText().length() > 0) if (fDocumentNo.getText().length() > 0)
pstmt.setString(index++, getSQLText(fDocumentNo)); pstmt.setString(index++, getSQLText(fDocumentNo));
if (fBPartner_ID.getDisplay() != "") if (!"".equals(fBPartner_ID.getDisplay()))
{ {
Integer bp = (Integer)fBPartner_ID.getValue(); Integer bp = (Integer)fBPartner_ID.getValue();
pstmt.setInt(index++, bp.intValue()); pstmt.setInt(index++, bp.intValue());
@ -399,7 +399,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
} }
} }
if (fAmtFrom.getText() != "" || fAmtTo.getText() != "") if (!"".equals(fAmtFrom.getText()) || !"".equals(fAmtTo.getText()))
{ {
BigDecimal from = new BigDecimal(fAmtFrom.getValue()); BigDecimal from = new BigDecimal(fAmtFrom.getValue());
BigDecimal to = new BigDecimal(fAmtTo.getValue()); BigDecimal to = new BigDecimal(fAmtTo.getValue());

View File

@ -1385,7 +1385,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
m_query.addRangeRestriction(ColumnSQL, parsedValue, parsedValue2, m_query.addRangeRestriction(ColumnSQL, parsedValue, parsedValue2,
infoName, infoDisplay, infoDisplay_to, and, openBrackets); infoName, infoDisplay, infoDisplay_to, and, openBrackets);
} }
else if (isProductCategoryField && MQuery.OPERATORS[MQuery.EQUAL_INDEX].equals(op)) { else if (isProductCategoryField && MQuery.OPERATORS[MQuery.EQUAL_INDEX].getValue().equals(Operator)) {
if (!(parsedValue instanceof Integer)) { if (!(parsedValue instanceof Integer)) {
continue; continue;
} }