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

Improving the validateJavaVersion() method

    XMLWordPrintable

Details

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

    Description

      I found in the POM file that the spring framework version used is 5, which requires version 1.8 JAVA. However, the JAVA version checking method accepts versions 1.6 and 1.7 (file -> https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/util/OpenmrsUtil.java).

      The problem is in the method:
      public static void validateJavaVersion() {
      // check whether the current JVM version is at least Java 6
      if (JdkVersion.getJavaVersion().matches("1.(0|1|2|3|4|5).(.*)"))

      { throw new APIException("OpenMRS requires Java 6, but is running under " + JdkVersion.getJavaVersion()); }

      }

      Proposed fix:
      public static void validateJavaVersion() {
      // check whether the current JVM version is at least Java 8
      if (JdkVersion.getJavaVersion().matches("1.(0|1|2|3|4|5|6|7).(.*)"))

      { throw new APIException("OpenMRS requires Java 8, but is running under " + JdkVersion.getJavaVersion()); }

      }

      Gliffy Diagrams

        Attachments

          Activity

            People

              sacull Lukasz Debicki
              sacull Lukasz Debicki
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 1 hour
                  1h
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h