This is an automated email from the ASF dual-hosted git repository. swebb2066 pushed a commit to branch date_pattern_validation in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
commit af9593e9eb70ae06ceed67615f25f5a39c710519 Author: Stephen Webb <[email protected]> AuthorDate: Sat Jan 25 17:01:26 2025 +1100 Ignore an invalid time zone specifier in a date pattern --- src/main/cpp/datepatternconverter.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/cpp/datepatternconverter.cpp b/src/main/cpp/datepatternconverter.cpp index d41fd29a..9f20d9ce 100644 --- a/src/main/cpp/datepatternconverter.cpp +++ b/src/main/cpp/datepatternconverter.cpp @@ -97,7 +97,7 @@ DateFormatPtr DatePatternConverter::getDateFormat(const OptionsList& options) maximumCacheValidity = CachedDateFormat::getMaximumCacheValidity(dateFormatStr); } - catch (IllegalArgumentException& e) + catch (std::exception& e) { df = std::make_shared<ISO8601DateFormat>(); LogLog::warn(((LogString) @@ -113,9 +113,17 @@ DateFormatPtr DatePatternConverter::getDateFormat(const OptionsList& options) if (options.size() >= 2) { - TimeZonePtr tz(TimeZone::getTimeZone(options[1])); + TimeZonePtr tz; + try + { + tz = TimeZone::getTimeZone(options[1]); + } + catch (std::exception& e) + { + LogLog::warn(LOG4CXX_STR("Invalid time zone: ") + options[1], e); + } - if (tz != NULL) + if (tz) { df->setTimeZone(tz); }
