File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
main/java/org/jabref/logic/util
test/java/org/jabref/logic/util Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,9 @@ public class Version {
2929 private static final Version UNKNOWN_VERSION = new Version ();
3030
3131 private final static Pattern VERSION_PATTERN = Pattern .compile ("(?<major>\\ d+)(\\ .(?<minor>\\ d+))?(\\ .(?<patch>\\ d+))?(?<stage>-alpha|-beta)?(?<dev>-?dev)?.*" );
32- private static final String JABREF_GITHUB_RELEASES = "https://api.github.com/repos/JabRef/JabRef/releases" ;
32+ private final static Pattern CI_SUFFIX_PATTERN = Pattern . compile ( "-ci \\ . \\ d+$" ) ;
3333
34+ private static final String JABREF_GITHUB_RELEASES = "https://api.github.com/repos/JabRef/JabRef/releases" ;
3435
3536 private String fullVersion = BuildInfo .UNKNOWN_VERSION ;
3637 private int major = -1 ;
@@ -58,6 +59,10 @@ public static Version parse(String version) {
5859
5960 Version parsedVersion = new Version ();
6061
62+ // remove "-ci.1" suffix
63+ Matcher ciSuffixMatcher = CI_SUFFIX_PATTERN .matcher (version );
64+ version = ciSuffixMatcher .replaceAll ("" );
65+
6166 parsedVersion .fullVersion = version ;
6267 Matcher matcher = VERSION_PATTERN .matcher (version );
6368 if (matcher .find ()) {
@@ -277,7 +282,7 @@ public static DevelopmentStage parse(String stage) {
277282 } else if (stage .equals (BETA .stage )) {
278283 return BETA ;
279284 }
280- LOGGER .warn ("Unknown development stage: " + stage );
285+ LOGGER .warn ("Unknown development stage: {}" , stage );
281286 return UNKNOWN ;
282287 }
283288
Original file line number Diff line number Diff line change @@ -282,4 +282,10 @@ public void alphaShouldBeUpdatedToStables() {
282282 List <Version > availableVersions = Arrays .asList (Version .parse ("2.8-beta" ), stable );
283283 assertEquals (Optional .of (stable ), alpha .shouldBeUpdatedTo (availableVersions ));
284284 }
285+
286+ @ Test
287+ public void ciSuffixShouldBeRemoved () {
288+ Version v50ci = Version .parse ("5.0-ci.1" );
289+ assertEquals ("5.0" , v50ci .getFullVersion ());
290+ }
285291}
You can’t perform that action at this time.
0 commit comments