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

Use Boolean.valueOf to test strings

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Should
    • Resolution: Fixed
    • None
    • Core 2.1.0
    • None
    • None

    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

      Gliffy Diagrams

        Attachments

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: