Fix transaction definition setTimeout error message since zero is valid

This commit rephrases the `DefaultTransactionDefinition#setTimeout`
exception message to better reflect the fact that 0 is a valid input
value.

Even though this often leads to a transaction immediately timing out
after opening, there is one notable case where this has another
meaningful effect: in Jakarta transactions (`UserTransaction`), when
passing 0 "the transaction service restores the default value".

Closes gh-32635
This commit is contained in:
xumengqi
2024-04-14 22:51:43 +08:00
committed by Simon Baslé
parent bf3278596c
commit 8ec27438e7

View File

@@ -227,7 +227,7 @@ public class DefaultTransactionDefinition implements TransactionDefinition, Seri
*/
public final void setTimeout(int timeout) {
if (timeout < TIMEOUT_DEFAULT) {
throw new IllegalArgumentException("Timeout must be a positive integer or TIMEOUT_DEFAULT");
throw new IllegalArgumentException("Timeout must be a non-negative integer or TIMEOUT_DEFAULT");
}
this.timeout = timeout;
}