Skip to content

Commit 562932c

Browse files
ssambasuSameeraPriyathamTadikonda
authored andcommitted
DHFPROD-3272: Support 9.x >= 9.0-10 , 10.x >=10.0-2
1 parent 5fff597 commit 562932c

File tree

2 files changed

+39
-34
lines changed

2 files changed

+39
-34
lines changed

marklogic-data-hub/src/main/java/com/marklogic/hub/impl/DataHubImpl.java

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -264,49 +264,54 @@ public boolean isServerVersionValid(String versionString) {
264264
return false;
265265
}
266266
boolean isNightly = versionString.matches("[^-]+-(\\d{4})(\\d{2})(\\d{2})");
267-
//Support any 9.0 version > 9.0-7 and all 10.0 versions.
268-
if (major == 9) {
269-
int minor = 0;
267+
//Support 9.0 versions >= 9.0-10 and 10.0 versions >=10.0-2.
268+
int minor = 0;
270269

271-
//Extract minor version in cases where versions is of type 9.0-6 or 9.0-6.2
272-
if(versionString.matches("^.*-(.+)\\..*")) {
273-
minor = Integer.parseInt(versionString.replaceAll("^.*-(.+)\\..*", "$1"));
274-
}
275-
else if(versionString.matches("^.*-(.+)$")){
276-
minor = Integer.parseInt(versionString.replaceAll("^.*-(.+)$", "$1"));
277-
}
278-
//left pad minor version with 0 if it is < 10
279-
String modifiedMinor = minor < 10 ? StringUtils.leftPad(String.valueOf(minor), 2, "0"):String.valueOf(minor) ;
270+
//Extract minor version in cases where versions is of type 9.0-6 or 9.0-6.2
271+
if(versionString.matches("^.*-(.+)\\..*")) {
272+
minor = Integer.parseInt(versionString.replaceAll("^.*-(.+)\\..*", "$1"));
273+
}
274+
else if(versionString.matches("^.*-(.+)$")){
275+
minor = Integer.parseInt(versionString.replaceAll("^.*-(.+)$", "$1"));
276+
}
277+
//left pad minor version with 0 if it is < 10
278+
String modifiedMinor = minor < 10 ? StringUtils.leftPad(String.valueOf(minor), 2, "0"):String.valueOf(minor) ;
280279

281-
int hotFixNum = 0;
280+
int hotFixNum = 0;
282281

283-
//Extract hotfix in cases where versions is of type 9.0-6.2, if not it will be 0
284-
if(versionString.matches("^.*-(.+)\\.(.*)")) {
285-
hotFixNum = Integer.parseInt(versionString.replaceAll("^.*-(.+)\\.(.*)", "$2"));
282+
//Extract hotfix in cases where versions is of type 9.0-6.2, if not it will be 0
283+
if(versionString.matches("^.*-(.+)\\.(.*)")) {
284+
hotFixNum = Integer.parseInt(versionString.replaceAll("^.*-(.+)\\.(.*)", "$2"));
285+
}
286+
//left pad minor version with 0 if it is < 10
287+
String modifiedHotFixNum = hotFixNum < 10 ? StringUtils.leftPad(String.valueOf(hotFixNum), 2, "0"):String.valueOf(hotFixNum) ;
288+
String alteredString = StringUtils.join(modifiedMinor, modifiedHotFixNum);
289+
int ver = Integer.parseInt(alteredString);
290+
if (major == 9) {
291+
//ver >= 1000 => 9.0-10 and above is supported
292+
if (!isNightly && ver < 1000) {
293+
return false;
286294
}
287-
//left pad minor version with 0 if it is < 10
288-
String modifiedHotFixNum = hotFixNum < 10 ? StringUtils.leftPad(String.valueOf(hotFixNum), 2, "0"):String.valueOf(hotFixNum) ;
289-
String alteredString = StringUtils.join(modifiedMinor, modifiedHotFixNum);
290-
int ver = Integer.parseInt(alteredString);
291-
292-
//ver >= 700 => 9.0-7 and above is supported
293-
if (!isNightly && ver < 700) {
295+
}
296+
if (major == 10) {
297+
//ver >= 200 => 10.0-2 and above is supported
298+
if (!isNightly && ver < 200) {
294299
return false;
295300
}
296301
}
297302
if (isNightly) {
298303
String dateString = versionString.replaceAll("[^-]+-(\\d{4})(\\d{2})(\\d{2})", "$1-$2-$3");
299304
//Support all 9.0-nightly on or after 11/5/2018
300305
if(major == 9) {
301-
Date minDate = new GregorianCalendar(2018, Calendar.NOVEMBER, 5).getTime();
306+
Date minDate = new GregorianCalendar(2019, Calendar.SEPTEMBER, 16).getTime();
302307
Date date = new SimpleDateFormat("y-M-d").parse(dateString);
303308
if (date.before(minDate)) {
304309
return false;
305310
}
306311
}
307312
//Support all 10.0-nightly on or after 6/11/2019
308313
if(major == 10) {
309-
Date minDate = new GregorianCalendar(2019, Calendar.JUNE, 1).getTime();
314+
Date minDate = new GregorianCalendar(2019, Calendar.SEPTEMBER, 26).getTime();
310315
Date date = new SimpleDateFormat("y-M-d").parse(dateString);
311316
if (date.before(minDate)) {
312317
return false;

0 commit comments

Comments
 (0)