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

ProgramWorkflowEditor tries to get workflow by uuid twice

    Details

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

      Description

      PropertyEditors within OpenMRS usually try to get an OpenmrsObject first via its id and if not found by its uuid.

      looking like this:

      if (StringUtils.hasText(text)) {
        try {
          setValue(es.getEncounter(Integer.valueOf(text)));
        }
        catch (Exception ex) {
          Encounter encounter = es.getEncounterByUuid(text);
          setValue(encounter);
          if (encounter == null) {
            throw new IllegalArgumentException()
          }
      }
      

      ProgramWorkflowEditor tries to get the object twice via its uuid.

      If nothing is found the first time, this will not change.

      Furthermore, the catch block will never be reached since getByUuid() just returns null if nothing is found. The exception in the try block is normally thrown by Integer.valueOf() if the text is a uuid and not a number.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: