better comments
This commit is contained in:
parent
12e7221e8c
commit
c97c455d09
@ -22,7 +22,7 @@ public class ExpirationProbe extends Probe<Credential> {
|
||||
@Override
|
||||
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.
|
||||
*/
|
||||
JsonNode node = crd.getJson().get(crd.getExpiresAtPropertyName());
|
||||
@ -30,10 +30,10 @@ public class ExpirationProbe extends Probe<Credential> {
|
||||
try {
|
||||
ZonedDateTime expirationDate = ZonedDateTime.parse(node.textValue());
|
||||
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) {
|
||||
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);
|
||||
|
@ -22,7 +22,7 @@ public class IssuanceProbe extends Probe<Credential> {
|
||||
@Override
|
||||
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.
|
||||
*/
|
||||
JsonNode node = crd.getJson().get(crd.getIssuedOnPropertyName());
|
||||
@ -30,10 +30,10 @@ public class IssuanceProbe extends Probe<Credential> {
|
||||
try {
|
||||
ZonedDateTime issuanceDate = ZonedDateTime.parse(node.textValue());
|
||||
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) {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user