From 926ed51d9be0848e7b0749cf66e4845da6212ea7 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Thu, 23 Apr 2020 18:05:12 -0400 Subject: [PATCH] NO-JIRA Cleaning ErrorProne Warning it is intentional to compare brokerURL == DEFAULT_BROKER_URL here so, I added a @SuppressWarnings to clear the false positivie. And also added some comment on why this is intentional. --- .../artemis/cli/commands/messages/ConnectionAbstract.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/ConnectionAbstract.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/ConnectionAbstract.java index b889ed62de..c11127d96e 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/ConnectionAbstract.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/ConnectionAbstract.java @@ -92,10 +92,18 @@ public class ConnectionAbstract extends InputAbstract { this.protocol = protocol; } + @SuppressWarnings("StringEquality") @Override public Object execute(ActionContext context) throws Exception { super.execute(context); + // it is intentional to make a comparison on the String object here + // this is to test if the original option was switched or not. + // we don't care about being .equals at all. + // as a matter of fact if you pass brokerURL in a way it's equals to DEFAULT_BROKER_URL, + // we should not the broker URL Instance + // and still honor the one passed by parameter. + // SupressWarnings was added to this method to supress the false positive here from error-prone. if (brokerURL == DEFAULT_BROKER_URL) { String brokerURLInstance = getBrokerURLInstance();