Changeset 9199 in josm


Ignore:
Timestamp:
2015-12-28T15:21:30+01:00 (9 years ago)
Author:
Don-vip
Message:

see #11924 - add compatibility with new Java 9 version scheme (MAJOR.MINOR.SECURITY, see JEP 223)

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/TestUtils.java

    r8793 r9199  
    109109
    110110    /**
    111      * Returns the Java version as a double value.
    112      * @return the Java version as a double value (1.7, 1.8, 1.9, etc.)
     111     * Returns the Java version as an int value.
     112     * @return the Java version as an int value (7, 8, 9, etc.)
    113113     */
    114     public static double getJavaVersion() {
     114    public static int getJavaVersion() {
    115115        String version = System.getProperty("java.version");
    116         int pos = version.indexOf('.');
    117         pos = version.indexOf('.', pos + 1);
    118         return Double.parseDouble(version.substring(0, pos));
     116        if (version.startsWith("1.")) {
     117            version = version.substring(2);
     118        }
     119        return Integer.parseInt(version.substring(0, version.indexOf('.')));
    119120    }
    120121}
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java

    r9133 r9199  
    5454
    5555    private static String getProjectionDataFile() {
    56         return TestUtils.getJavaVersion() >= 1.9 ? PROJECTION_DATA_FILE_JAVA_9 : PROJECTION_DATA_FILE;
     56        return TestUtils.getJavaVersion() >= 9 ? PROJECTION_DATA_FILE_JAVA_9 : PROJECTION_DATA_FILE;
    5757    }
    5858
Note: See TracChangeset for help on using the changeset viewer.