You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enhanced the Version class to support pre-release identifiers in version strings (e.g., 1.2.3-alpha). Updated parsing, comparison, and string representation logic to handle pre-release values according to semantic versioning. Improved null checks and refactored version parsing to use StringUtils.split instead of StringTokenizer.
StringerrorMessage = format("The 'Implementation-Version' manifest attribute can't be fetched from the jar file[class resource : '{}'] by the target class[name :'{}']", classResource, targetClass.getName());
344
410
thrownewIllegalArgumentException(errorMessage);
345
411
}
346
412
returnof(version);
347
413
}
348
414
349
-
staticintgetValue(StringTokenizerst) {
350
-
if (st.hasMoreTokens()) {
351
-
returngetValue(st.nextToken());
352
-
}
353
-
return0;
354
-
}
355
-
356
415
staticintgetValue(Stringpart) {
357
416
finalintvalue;
358
417
try {
@@ -374,10 +433,10 @@ public boolean test(Version v1, Version v2) {
374
433
if (v1 == v2) {
375
434
returntrue;
376
435
}
377
-
if (v2 == null) returnfalse;
378
-
if (v1.major != v2.major)returnfalse;
379
-
if (v1.minor != v2.minor) returnfalse;
380
-
returnv1.patch == v2.patch;
436
+
if (v1 == null || v2 == null) {
437
+
returnfalse;
438
+
}
439
+
returnv1.compareTo(v2) == 0;
381
440
}
382
441
},
383
442
@@ -390,7 +449,9 @@ public boolean test(Version v1, Version v2) {
390
449
if (v1 == v2) {
391
450
returnfalse;
392
451
}
393
-
if (v2 == null) returnfalse;
452
+
if (v1 == null || v2 == null) {
453
+
returnfalse;
454
+
}
394
455
returnv1.compareTo(v2) < 0;
395
456
}
396
457
},
@@ -404,7 +465,9 @@ public boolean test(Version v1, Version v2) {
404
465
if (v1 == v2) {
405
466
returntrue;
406
467
}
407
-
if (v2 == null) returnfalse;
468
+
if (v1 == null || v2 == null) {
469
+
returnfalse;
470
+
}
408
471
returnv1.compareTo(v2) <= 0;
409
472
}
410
473
},
@@ -418,7 +481,9 @@ public boolean test(Version v1, Version v2) {
418
481
if (v1 == v2) {
419
482
returnfalse;
420
483
}
421
-
if (v2 == null) returnfalse;
484
+
if (v1 == null || v2 == null) {
485
+
returnfalse;
486
+
}
422
487
returnv1.compareTo(v2) > 0;
423
488
}
424
489
},
@@ -432,7 +497,9 @@ public boolean test(Version v1, Version v2) {
432
497
if (v1 == v2) {
433
498
returntrue;
434
499
}
435
-
if (v2 == null) returnfalse;
500
+
if (v1 == null || v2 == null) {
501
+
returnfalse;
502
+
}
436
503
returnv1.compareTo(v2) >= 0;
437
504
}
438
505
};
@@ -474,6 +541,5 @@ public static Operator of(String symbol) {
0 commit comments