From a07cb45222f175a405866b863da5eca33e44f736 Mon Sep 17 00:00:00 2001 From: Timothy Bish Date: Fri, 8 Sep 2017 11:41:28 -0400 Subject: [PATCH] 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). --- .../activemq/artemis/core/server/NetworkHealthCheck.java | 2 +- .../impl/view/predicate/ActiveMQFilterPredicate.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java index 432c62a7a6..90628ea54c 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java @@ -378,7 +378,7 @@ public class NetworkHealthCheck extends ActiveMQScheduledComponent { String inputLine; while ((inputLine = reader.readLine()) != null) { if (error) { - ActiveMQUtilLogger.LOGGER.failedToReadFromStream(inputLine == null ? " " : inputLine); + ActiveMQUtilLogger.LOGGER.failedToReadFromStream(inputLine); } else { logger.trace(inputLine); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/predicate/ActiveMQFilterPredicate.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/predicate/ActiveMQFilterPredicate.java index 0195935e30..b693c4a6bb 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/predicate/ActiveMQFilterPredicate.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/predicate/ActiveMQFilterPredicate.java @@ -92,14 +92,14 @@ public class ActiveMQFilterPredicate implements Predicate { private boolean equals(Object field, Object value) { if (field == null) { - return (value.equals("") || value == null); + return (value == null || value.equals("")); } return field.toString().equals(value); } private boolean contains(Object field, Object value) { if (field == null) { - return (value.equals("") || value == null); + return (value == null || value.equals("")); } return field.toString().contains(value.toString()); }