Include actual cause's message in various parsing exception messages

This change improves the message of several parsing-related exceptions
that would previously entirely swallow the original exception's message
and sometimes have a slightly misleading message as a result.

This is done by appending the cause's `toString` representation to the
IllegalArgumentException messages instead of an hardcoded "cause".

Closes gh-32636
This commit is contained in:
xumengqi 2024-04-14 23:21:19 +08:00 committed by Simon Baslé
parent 3971632415
commit bf3278596c
2 changed files with 4 additions and 4 deletions

View File

@ -411,7 +411,7 @@ public class ScheduledAnnotationBeanPostProcessor
}
catch (RuntimeException ex) {
throw new IllegalArgumentException(
"Invalid initialDelayString value \"" + initialDelayString + "\" - cannot parse into long");
"Invalid initialDelayString value \"" + initialDelayString + "\"; " + ex);
}
}
}
@ -463,7 +463,7 @@ public class ScheduledAnnotationBeanPostProcessor
}
catch (RuntimeException ex) {
throw new IllegalArgumentException(
"Invalid fixedDelayString value \"" + fixedDelayString + "\" - cannot parse into long");
"Invalid fixedDelayString value \"" + fixedDelayString + "\"; " + ex);
}
tasks.add(this.registrar.scheduleFixedDelayTask(new FixedDelayTask(runnable, fixedDelay, delayToUse)));
}
@ -489,7 +489,7 @@ public class ScheduledAnnotationBeanPostProcessor
}
catch (RuntimeException ex) {
throw new IllegalArgumentException(
"Invalid fixedRateString value \"" + fixedRateString + "\" - cannot parse into long");
"Invalid fixedRateString value \"" + fixedRateString + "\"; " + ex);
}
tasks.add(this.registrar.scheduleFixedRateTask(new FixedRateTask(runnable, fixedRate, delayToUse)));
}

View File

@ -207,7 +207,7 @@ public class DefaultTransactionAttribute extends DefaultTransactionDefinition im
}
catch (RuntimeException ex) {
throw new IllegalArgumentException(
"Invalid timeoutString value \"" + timeoutString + "\" - cannot parse into int");
"Invalid timeoutString value \"" + timeoutString + "\"; " + ex);
}
}
}