Details
Description
SonarQube:
A dead store happens when a local variable is assigned a value that is not read by any subsequent instruction. Calculating or retrieving a value only to then overwrite it or throw it away, could indicate a serious error in the code. Even if it's not an error, it is at best a waste of resources. Therefore all calculated values should be used.
Problem:
The variable is assigned a value, which line is further overwritten.
Solution:
Removal of an unused assignment.
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/PatientIdentifierResource1_8.java#L113
- 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/UserResource1_8.java#L192
Support materials:
- explanation of the problem by SonarQube: https://sonar.openmrs.org/coding_rules#rule_key=squid%3AS1854