XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Code Review (Initial)
    • Priority: Could
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Core 2.3.3
    • Component/s: None
    • Labels:
    • Complexity:
      Low

      Description

      Case:
      In the classes of the org.openmrs.validator package, the validate method casts a variable of type Object on a variable of type validator, without checking whether the variable is of type validator. The problem occurs in most classes. Several classes have this check.

      Problem:
      In classes in which the type of the variable is not checked before casting, if the variable is of a different type, this may result in throwing an exception that is not declared in the code.

      Fix:
      Add class check before casting.

      Link to place in code without checking before casting:
      https://github.com/openmrs/openmrs-core/blob/a4f37ed4aa7b068ba42a8c7b6537fcbd59dabfca/api/src/main/java/org/openmrs/validator/AlertValidator.java#L45

      Link to place in code with a check before casting:
      https://github.com/openmrs/openmrs-core/blob/a4f37ed4aa7b068ba42a8c7b6537fcbd59dabfca/api/src/main/java/org/openmrs/validator/ConceptMapTypeValidator.java#L55-L60

        Gliffy Diagrams

          Attachments

            Activity

              People

              Assignee:
              bejanut Alexandru-Gabriel Bejan
              Reporter:
              sacull Lukasz Debicki
              Designated Committer:
              Lukasz Debicki Lukasz Debicki
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - 4 hours Original Estimate - 4 hours
                  4h
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 6 hours
                  6h