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.
This commit is contained in:
Clebert Suconic 2020-04-23 18:05:12 -04:00
parent 46e1207942
commit 926ed51d9b
1 changed files with 8 additions and 0 deletions

View File

@ -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();