Fix Java version filters #18
Fixed lookup of Java versions in listing versions to convert string values like 1.7 to a number 7, to take advantage of raw number comparisons. Fixed issue where version filters weren't properly being restricted to a single document.
Signed-off-by: Martin Lowe martin.lowe@eclipse-foundation.org
Merge request reports
Activity
Filter activity
13 * Used to handle the conversion of Java versions to and from storage mediums. 14 * 15 * @author Martin Lowe 16 * 17 */ 18 public class JavaVersionHelper { 19 private static final Pattern MAJOR_VERSION_CHECK = Pattern.compile("^\\d\\.([^\\.\\D]+)"); 20 21 /** 22 * Converts value to strip out parts of Java version string that cause issues 23 * with natural number sorting in databases. 24 * 25 * @param val the java version string to convert (e.g. 1.7, 1.10) 26 * @return modified and more sortable version string 27 */ 28 public static final String convertToDBSafe(String val) { 40 int idx = out.indexOf('.'); 41 if (idx > -1) { 42 out = out.substring(0, idx); 43 } 44 45 return out; 46 } 47 48 /** 49 * Converts the sortable DB value for the Java version to something more in line 50 * with what is expected by the user. 51 * 52 * @param val the sortable stored version string 53 * @return display value of the sortable Java version 54 */ 55 public static final String convertToDisplayValue(String val) {
Please register or sign in to reply