better comments

This commit is contained in:
Xavi Aracil 2024-03-21 17:24:50 +01:00
parent 12e7221e8c
commit c97c455d09
2 changed files with 6 additions and 6 deletions

View File

@ -22,7 +22,7 @@ public class ExpirationProbe extends Probe<Credential> {
@Override @Override
public ReportItems run(Credential crd, RunContext ctx) throws Exception { public ReportItems run(Credential crd, RunContext ctx) throws Exception {
/* /*
* If the AchievementCredential or EndorsementCredential has an expirationDate property * If the AchievementCredential or EndorsementCredential has an expirationDate or "validUntil" property
* and the expiration date is prior to the current date, the credential has expired. * and the expiration date is prior to the current date, the credential has expired.
*/ */
JsonNode node = crd.getJson().get(crd.getExpiresAtPropertyName()); JsonNode node = crd.getJson().get(crd.getExpiresAtPropertyName());
@ -30,10 +30,10 @@ public class ExpirationProbe extends Probe<Credential> {
try { try {
ZonedDateTime expirationDate = ZonedDateTime.parse(node.textValue()); ZonedDateTime expirationDate = ZonedDateTime.parse(node.textValue());
if (ZonedDateTime.now().isAfter(expirationDate)) { if (ZonedDateTime.now().isAfter(expirationDate)) {
return fatal("The credential has expired (expiration date was " + node.asText() + ").", ctx); return fatal("The credential has expired (expiration date or validUntil was " + node.asText() + ").", ctx);
} }
} catch (Exception e) { } catch (Exception e) {
return exception("Error while checking expirationDate: " + e.getMessage(), ctx.getResource()); return exception("Error while checking expirationDate or validUntil: " + e.getMessage(), ctx.getResource());
} }
} }
return success(ctx); return success(ctx);

View File

@ -22,7 +22,7 @@ public class IssuanceProbe extends Probe<Credential> {
@Override @Override
public ReportItems run(Credential crd, RunContext ctx) throws Exception { public ReportItems run(Credential crd, RunContext ctx) throws Exception {
/* /*
* If the AchievementCredential or EndorsementCredential issuanceDate * If the AchievementCredential or EndorsementCredential issuanceDate or "validFrom"
* property after the current date, the credential is not yet valid. * property after the current date, the credential is not yet valid.
*/ */
JsonNode node = crd.getJson().get(crd.getIssuedOnPropertyName()); JsonNode node = crd.getJson().get(crd.getIssuedOnPropertyName());
@ -30,10 +30,10 @@ public class IssuanceProbe extends Probe<Credential> {
try { try {
ZonedDateTime issuanceDate = ZonedDateTime.parse(node.textValue()); ZonedDateTime issuanceDate = ZonedDateTime.parse(node.textValue());
if (issuanceDate.isAfter(ZonedDateTime.now())) { if (issuanceDate.isAfter(ZonedDateTime.now())) {
return fatal("The credential is not yet issued (issuance date is " + node.asText() + ").", ctx); return fatal("The credential is not yet issued or valid (issuance date or validFrom is " + node.asText() + ").", ctx);
} }
} catch (Exception e) { } catch (Exception e) {
return exception("Error while checking issuanceDate: " + e.getMessage(), ctx.getResource()); return exception("Error while checking issuanceDate or ValidFrom: " + e.getMessage(), ctx.getResource());
} }
} }
return success(ctx); return success(ctx);