IDEMPIERE-455 Discover and fix FindBugs problems / Pattern RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE

This commit is contained in:
Richard Morales 2012-12-10 13:06:55 -05:00
parent b5a2bd6dba
commit 05b0af19e5
5 changed files with 12 additions and 12 deletions

View File

@ -1276,6 +1276,7 @@ public class CConnection implements Serializable, Cloneable
* @param transactionIsolation Connection transaction level * @param transactionIsolation Connection transaction level
* @return Connection * @return Connection
*/ */
@SuppressWarnings("unused")
public Connection getConnection (boolean autoCommit, int transactionIsolation) public Connection getConnection (boolean autoCommit, int transactionIsolation)
{ {
Connection conn = null; Connection conn = null;

View File

@ -347,8 +347,9 @@ public final class DB
if (conn != null) if (conn != null)
{ {
conn.close(); conn.close();
success = true;
} }
success = (conn != null); else success = false;
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -575,9 +575,9 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
// Elaine 2009/02/06 save preference to AD_Preference // Elaine 2009/02/06 save preference to AD_Preference
UserPreference userPreference = SessionManager.getSessionApplication().getUserPreference(); UserPreference userPreference = SessionManager.getSessionApplication().getUserPreference();
userPreference.setProperty(UserPreference.P_LANGUAGE, Env.getContext(m_ctx, UserPreference.LANGUAGE_NAME)); userPreference.setProperty(UserPreference.P_LANGUAGE, Env.getContext(m_ctx, UserPreference.LANGUAGE_NAME));
userPreference.setProperty(UserPreference.P_ROLE, lstItemRole != null ? (String) lstItemRole.getValue() : "0"); userPreference.setProperty(UserPreference.P_ROLE, (String) lstItemRole.getValue());
userPreference.setProperty(UserPreference.P_CLIENT, lstItemClient != null ? (String) lstItemClient.getValue() : "0"); userPreference.setProperty(UserPreference.P_CLIENT, (String) lstItemClient.getValue());
userPreference.setProperty(UserPreference.P_ORG, lstItemOrg != null ? (String) lstItemOrg.getValue() : "0"); userPreference.setProperty(UserPreference.P_ORG, (String) lstItemOrg.getValue());
userPreference.setProperty(UserPreference.P_WAREHOUSE, lstItemWarehouse != null ? (String) lstItemWarehouse.getValue() : "0"); userPreference.setProperty(UserPreference.P_WAREHOUSE, lstItemWarehouse != null ? (String) lstItemWarehouse.getValue() : "0");
userPreference.savePreference(); userPreference.savePreference();
// //

View File

@ -1302,11 +1302,13 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
String lBrackets = listLeftBracket.getSelectedItem().getValue().toString(); String lBrackets = listLeftBracket.getSelectedItem().getValue().toString();
if ( lBrackets != null ) if ( lBrackets != null )
openBrackets += lBrackets.length(); openBrackets += lBrackets.length();
else lBrackets = "";
// Right brackets // Right brackets
Listbox listRightBracket = (Listbox)row.getFellow("listRightBracket"+row.getId()); Listbox listRightBracket = (Listbox)row.getFellow("listRightBracket"+row.getId());
String rBrackets = listRightBracket.getSelectedItem().getValue().toString(); String rBrackets = listRightBracket.getSelectedItem().getValue().toString();
if ( rBrackets != null ) if ( rBrackets != null )
openBrackets -= rBrackets.length(); openBrackets -= rBrackets.length();
else rBrackets = "";
// And Or // And Or
Listbox listAndOr = (Listbox)row.getFellow("listAndOr"+row.getId()); Listbox listAndOr = (Listbox)row.getFellow("listAndOr"+row.getId());
String andOr = listAndOr.getSelectedItem().getValue().toString(); String andOr = listAndOr.getSelectedItem().getValue().toString();
@ -1341,9 +1343,9 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
.append(FIELD_SEPARATOR) .append(FIELD_SEPARATOR)
.append(andOr) .append(andOr)
.append(FIELD_SEPARATOR) .append(FIELD_SEPARATOR)
.append(lBrackets != null ? lBrackets : "") .append(lBrackets)
.append(FIELD_SEPARATOR) .append(FIELD_SEPARATOR)
.append(rBrackets != null ? rBrackets : ""); .append(rBrackets);
} }
continue; continue;
} }
@ -1392,9 +1394,9 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
.append(FIELD_SEPARATOR) .append(FIELD_SEPARATOR)
.append(andOr) .append(andOr)
.append(FIELD_SEPARATOR) .append(FIELD_SEPARATOR)
.append(lBrackets != null ? lBrackets : "") .append(lBrackets)
.append(FIELD_SEPARATOR) .append(FIELD_SEPARATOR)
.append(rBrackets != null ? rBrackets : ""); .append(rBrackets);
} }
String selected = fQueryName.getValue(); String selected = fQueryName.getValue();
if (selected != null) { if (selected != null) {

View File

@ -516,8 +516,6 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
if (source.equals(fUser)) { if (source.equals(fUser)) {
// fUser // fUser
if (value == null)
fTo.setText("");
if (value instanceof Integer) if (value instanceof Integer)
{ {
int AD_User_ID = ((Integer)value).intValue(); int AD_User_ID = ((Integer)value).intValue();
@ -526,8 +524,6 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
} }
} else { } else {
// fCcUser // fCcUser
if (value == null)
fCc.setText("");
if (value instanceof Integer) if (value instanceof Integer)
{ {
int AD_User_ID = ((Integer)value).intValue(); int AD_User_ID = ((Integer)value).intValue();