When timeoutString is "-2", DefaultTransactionDefinition#setTimeout method will throw IllegalArgumentException(it extends RuntimeException), we will get the error message: Invalid timeoutString value "-2" - cannot parse into int.

But actually "-2" can parse into int.

In other words, the error message cannot parse into int is just right for Integer#parseInt, so I change RuntimeException to NumberFormatException. So: - When timeoutString is "1", just ok. - When timeoutString is "-2", we will get: Timeout must be a positive integer or TIMEOUT_DEFAULT. - When timeoutString is "foo", we will get: Invalid timeoutString value "foo" - cannot parse into int.

try {
    setTimeout(Integer.parseInt(timeoutString));
}
catch (RuntimeException ex) {
    throw new IllegalArgumentException(
            "Invalid timeoutString value \"" + timeoutString + "\" - cannot parse into int");
}

Comment From: remeio

Thanks, I agree with you.

Comment From: simonbasle

(marking as type: bug on @jhoeller suggestion, albeit a mild one: the original exception should percolate through to the user one way or another but here it is entirely swallowed / masked)