1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-12-23 03:17:58 +01: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)); 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) { private void enforceBounds(long secondsFromCreationToExpiration) {
if (secondsFromCreationToExpiration < 0) { if (secondsFromCreationToExpiration < 0) {
throw new IllegalArgumentException("Seconds from creation to expiration cannot be less than 0."); throw new IllegalArgumentException("Seconds from creation to expiration cannot be less than 0.");