Merge branch 'master' into bug5627

This commit is contained in:
Axel Uhl
2023-01-04 23:25:41 +01:00
@@ -169,13 +169,21 @@ public class TestORCPublicCertificateDatabase {
*/ null, /* includeInvalid */ false);
}
if (Util.isEmpty(certHandles)) {
// there were certs; get one from the previous year
// there were certs; try searching by reference number
certHandles = db.search(null, LocalDate.now().getYear(), cert.getReferenceNumber(), /* boat name may have deviated due to special characters */ null,
cert.getSailNumber(), /*
* boat class name; could be set to cert.getBoatClassName() but there are
* deviations in ORC DBs and query API, so leaving null:
*/ null, /* includeInvalid */ false);
}
if (Util.isEmpty(certHandles)) {
// still nothing? Then try by reference number in previous year:
certHandles = db.search(null, LocalDate.now().getYear()-1, cert.getReferenceNumber(), /* boat name may have deviated due to special characters */ null,
cert.getSailNumber(), /*
* boat class name; could be set to cert.getBoatClassName() but there are
* deviations in ORC DBs and query API, so leaving null:
*/ null, /* includeInvalid */ false);
}
Optional<CertificateHandle> certificateHandle = Optional.ofNullable(certHandles.iterator().hasNext() ? certHandles.iterator().next() : null);
assertTrue("No certificate found for handle "+certificateHandle+
" extracted from certificates "+certificates, certificateHandle.isPresent());