abhishekagarwal87 commented on a change in pull request #11423:
URL: https://github.com/apache/druid/pull/11423#discussion_r666670473
##########
File path: core/src/main/java/org/apache/druid/java/util/common/DateTimes.java
##########
@@ -53,14 +57,28 @@
"[0-9]{4}-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}(Z|[+\\-][0-9]{2}(:[0-9]{2}))"
);
- @SuppressForbidden(reason = "DateTimeZone#forID")
public static DateTimeZone inferTzFromString(String tzId)
+ {
+ return inferTzFromString(tzId, true);
+ }
+
+ /**
+ * @return The dateTimezone for the provided {@param tzId}. If {@param
fallback} is true, the default timezone
+ * will be returned if the tzId does not match a supported timezone.
+ * @throws IllegalArgumentException if {@param fallback} is false and the
provided tzId doesn't match a supported
+ * timezone.
+ */
+ @SuppressForbidden(reason = "DateTimeZone#forID")
+ public static DateTimeZone inferTzFromString(String tzId, boolean fallback)
throws IllegalArgumentException
{
try {
return DateTimeZone.forID(tzId);
}
catch (IllegalArgumentException e) {
// also support Java timezone strings
+ if (!fallback && !AVAILABLE_TIMEZONE_IDS.contains(tzId)) {
+ throw e;
Review comment:
what would be the message in this exception? If it is too cryptic, we
can add a message of our own that tzId is an invalid timezone.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]