Uploaded image for project: 'Webservices REST Module'
  1. Webservices REST Module
  2. RESTWS-609

Cleanup smell of exception as control flow using ModuleUtil

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: TBD
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.17
    • Labels:
      None
    • Complexity:
      Low

      Description

      In RestServiceImpl.addSearchHandler

      https://github.com/openmrs/openmrs-module-webservices.rest/blob/master/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/api/impl/RestServiceImpl.java#L332-L340

      A try/catch block is used to not execute a part of the code if a a specific OpenMRS version is not supported.

      ModuleException is thrown by ModuleUtil.checkRequiredVersion(OpenmrsConstants.OPENMRS_VERSION_SHORT, supportedVersion)

      The try/catch can be replaced by

      f(ModuleUtil.matchRequiredVersions(OpenmrsConstants.OPENMRS_VERSION_SHORT, supportedVersion)) {
      }
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: