Description
SonarQube:
This code compares java.lang.String objects for reference equality using the == or != operators. Unless both strings are either constants in a source file, or have been interned using the String.intern() method, the same string value may be represented by two different String objects. Consider using the equals(Object) method instead.
Problem:
Using == or != to compare String objects.
Solution:
Use the equals() method for this.
Where the problem occurs:
- https://github.com/openmrs/openmrs-module-webservices.rest/blob/2.28.0/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ModuleResource1_8.java#L210
- https://github.com/openmrs/openmrs-module-webservices.rest/blob/2.28.0/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/TaskDefinitionResource1_8.java#L157
- https://github.com/openmrs/openmrs-module-webservices.rest/blob/2.28.0/omod-common/src/main/java/org/openmrs/module/webservices/docs/swagger/SwaggerSpecificationCreator.java#L1041
Support materials:
- explanation of the problem by SonarQube: https://sonar.openmrs.org/coding_rules#rule_key=findbugs%3AES_COMPARING_STRINGS_WITH_EQ