-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Here
| ex.printStackTrace(); |
a stack trace is printed, after which a default new UTCProvider() is returned. This can lead to stack traces being printed to STDERR while no exception is actually thrown by Joda Time. For example, on Android, when running JVM unit tests, this can happen, e.g. see dlew/joda-time-android#148. (Joda Time Android uses Joda Time).
The solution for that issue is to set the default new UTCProvider() before using Joda Time in tests. This is not user friendly. It would be better if there was a way to get a provider without a stacktrace being printed, or to check if a provider is available before getting it (which is a bit silly, probably).
The proposed solution is to default to not printing the stack trace on the line linked above, or make the stack trace printing opt in through some kind of configuration. Alternatively, there could be a method to check if there is a provider, so that the user can provide their own if there is none.