1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-06-25 04:54:49 +02:00

Add documentation to enforceBounds()

This commit is contained in:
Paul Schaub 2022-06-01 13:40:07 +02:00
parent 44c32d0620
commit 444ec6d593
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -287,6 +287,13 @@ public class SignatureSubpackets
return setKeyExpirationTime(new KeyExpirationTime(isCritical, secondsFromCreationToExpiration));
}
/**
* Enforce that <pre>secondsFromCreationToExpiration</pre> is within bounds of an unsigned 32bit number.
* Values less than 0 are illegal, as well as values greater 0xffffffff.
*
* @param secondsFromCreationToExpiration number to check
* @throws IllegalArgumentException in case of an under- or overflow
*/
private void enforceBounds(long secondsFromCreationToExpiration) {
if (secondsFromCreationToExpiration < 0) {
throw new IllegalArgumentException("Seconds from creation to expiration cannot be less than 0.");