jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/Constants.java
changeset 34044 4c5494af1359
parent 27111 7a491d709b83
child 34463 c269a10aca11
equal deleted inserted replaced
31008:5b500c93ce48 34044:4c5494af1359
   855         return fgXercesProperties.length > 0
   855         return fgXercesProperties.length > 0
   856         ? new ArrayEnumeration(fgXercesProperties) : fgEmptyEnumeration;
   856         ? new ArrayEnumeration(fgXercesProperties) : fgEmptyEnumeration;
   857     } // getXercesProperties():Enumeration
   857     } // getXercesProperties():Enumeration
   858 
   858 
   859     /*
   859     /*
   860      * Check the version of the current JDK against that specified in the
   860      * Check the major version of the current JDK against that specified
   861      * parameter
   861      * in the parameter
   862      *
   862      *
   863      * There is a proposal to change the java version string to:
   863      * In JDK9 the java version string was changed to comply with JEP-223
   864      * MAJOR.MINOR.FU.CPU.PSU-BUILDNUMBER_BUGIDNUMBER_OPTIONAL
   864      * so this method was modified to handle that new format as well
   865      * This method would work with both the current format and that proposed
   865      *
   866      *
   866      * @param compareTo a JDK major version to be compared to
   867      * @param compareTo a JDK version to be compared to
   867      * @return true if the current major version is the same or above
   868      * @return true if the current version is the same or above that represented
   868      * that represented by the parameter
   869      * by the parameter
       
   870      */
   869      */
   871     public static boolean isJavaVersionAtLeast(int compareTo) {
   870     public static boolean isJavaVersionAtLeast(int compareTo) {
   872         String javaVersion = SecuritySupport.getSystemProperty("java.version");
   871         String javaVersion = SecuritySupport.getSystemProperty("java.version");
   873         String versions[] = javaVersion.split("\\.", 3);
   872         javaVersion = (javaVersion.matches("[1-9][0-9]*(\\.(0|[1-9][0-9]*))*\\-.*")) ?
   874         if (Integer.parseInt(versions[0]) >= compareTo ||
   873                           javaVersion.split("-|\\.")[0] :
   875             Integer.parseInt(versions[1]) >= compareTo) {
   874                           javaVersion.split("\\.", 3)[1];
   876             return true;
   875         return Integer.parseInt(javaVersion) >= compareTo;
   877         }
       
   878         return false;
       
   879     }
   876     }
   880 
   877 
   881     //
   878     //
   882     // Classes
   879     // Classes
   883     //
   880     //