src/main/java/net/wasdev/wlp/common/plugins/util/InstallFeatureUtil.java
private static int compare(String version1, String version2) {
        if (version1 == null && version2 == null) {
            return 0;
        } else if (version1 == null && version2 != null) {
            return -1;
        } else if (version1 != null && version2 == null) {
            return 1;
        }
        String[] components1 = version1.split("\\.");
        String[] components2 = version2.split("\\.");
        for (int i = 0; i < components1.length && i < components2.length; i++) {
            int comparison;
            try {
                comparison = new Integer(components1[i]).compareTo(new Integer(components2[i]));
            } catch (NumberFormatException e) {
                comparison = components1[i].compareTo(components2[i]);
            }
            if (comparison != 0) {
                return comparison;
            }
        }
        return components1.length - components2.length;
    }
private static int compare(String version1, String version2) {
        if (version1 == null && version2 == null) {
            return 0;
        } else if (version1 == null && version2 != null) {
            return -1;
        } else if (version1 != null && version2 == null) {
            return 1;
        }
        String[] components1 = version1.split("\\.");
        String[] components2 = version2.split("\\.");
        for (int i = 0; i < components1.length && i < components2.length; i++) {
            int comparison;
            try {
                comparison = new Integer(components1[i]).compareTo(new Integer(components2[i]));
            } catch (NumberFormatException e) {
                comparison = components1[i].compareTo(components2[i]);
            }
            if (comparison != 0) {
                return comparison;
            }
        }
        return components1.length - components2.length;
    }
private static int compare ( String version1 , String version2 ) { if ( version1 == null && version2 == null ) { return 0 ; } else if ( version1 == null && version2 != null ) { return - 1 ; } else if ( version1 != null && version2 == null ) { return 1 ; } String [ ] components1 = version1 . split ( "\\." ) ; String [ ] components2 = version2 . split ( "\\." ) ; for ( int i = 0 ; i < components1 . length && i < components2 . length ; i ++ ) { int comparison ; try { comparison = new Integer ( components1 [ i ] ) . compareTo ( new Integer ( components2 [ i ] ) ) ; } catch ( NumberFormatException e ) { comparison = components1 [ i ] . compareTo ( components2 [ i ] ) ; } if ( comparison != 0 ) { return comparison ; } } return components1 . length - components2 . length ; }
Performs pairwise comparison of version strings, including nulls and non-integer components.
@param version1
@param version2
@return positive if version1 is greater, negative if version2 is greater, otherwise 0
Performs pairwise comparison of version strings including nulls and non - integer components .