OpenMRS

Comparison of String object using != in Module.extensionsMatchNames()

Replace this line https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/module/Module.java#L533 with: if (!extensionNames.get(ext.getPointId()).equals(ext.getClass().getName())) { Background Information: Bad practice - Comparison of String objects using == or !=

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.

Task tags

  • coding
  • easy

Students who completed this task

Harshan Baskar

Task type

  • code Code
close

2017