Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-5035

Use Boolean.valueOf to test strings

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Should
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Core 2.1.0
    • Component/s: None
    • Labels:
      None
    • Complexity:
      Low

      Description

      The check

      if("true".equals(locked.toLowerCase()))
      

      in

      https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/api/impl/PersonServiceImpl.java#L949

      can be replaced by

      if(Boolean.valueOf(locked))
      

      Boolean.valueOf(String)

      since Boolean.valueOf(String) returns true if the string argument is not null and is equal, ignoring case, to the string "true" and otherwise false

      all occurences as pointed out by sonar issue should be replaced
      https://ci.openmrs.org/sonar/drilldown/issues/1865?&rule=squid%3AS1157&rule_sev=MAJOR

        Attachments

          Activity

            People

            Assignee:
            pkatopenmrs pkatopenmrs
            Reporter:
            teleivo Ivo Ulrich
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: