ARTEMIS-1400 Fix some minor issues spotted with FindBugs

Remove a bit of dead code, and invert two string tests that were testing
for null after comparing the value to empty string (NPE scenario).
This commit is contained in:
Timothy Bish 2017-09-08 11:41:28 -04:00
parent 1e28b2953a
commit a07cb45222
2 changed files with 3 additions and 3 deletions

View File

@ -378,7 +378,7 @@ public class NetworkHealthCheck extends ActiveMQScheduledComponent {
String inputLine; String inputLine;
while ((inputLine = reader.readLine()) != null) { while ((inputLine = reader.readLine()) != null) {
if (error) { if (error) {
ActiveMQUtilLogger.LOGGER.failedToReadFromStream(inputLine == null ? " " : inputLine); ActiveMQUtilLogger.LOGGER.failedToReadFromStream(inputLine);
} else { } else {
logger.trace(inputLine); logger.trace(inputLine);
} }

View File

@ -92,14 +92,14 @@ public class ActiveMQFilterPredicate<T> implements Predicate<T> {
private boolean equals(Object field, Object value) { private boolean equals(Object field, Object value) {
if (field == null) { if (field == null) {
return (value.equals("") || value == null); return (value == null || value.equals(""));
} }
return field.toString().equals(value); return field.toString().equals(value);
} }
private boolean contains(Object field, Object value) { private boolean contains(Object field, Object value) {
if (field == null) { if (field == null) {
return (value.equals("") || value == null); return (value == null || value.equals(""));
} }
return field.toString().contains(value.toString()); return field.toString().contains(value.toString());
} }