@Test public void testGuessTimeZoneNotFound() throws Exception { String defaultTimeZone = "Europe/Berlin"; String timezone = DateTimeAdjuster.guessTimeZone("Wrong Microsoft TimeZone"); assertEquals(defaultTimeZone, timezone); }
public static String guessTimeZone(String msName) { String timeZone = "Europe/Berlin"; try { Map<String, String> microsoftTimeZones = TimeZoneUtils.createOlsonTimeZoneToMsMap(); if (microsoftTimeZones != null) { timeZone = microsoftTimeZones.entrySet().stream().filter(entry -> entry.getValue().equals(msName)).map(Map.Entry::getKey) .findFirst().orElse(timeZone); } } catch (Exception e) { LOG.warn("Cannot take Java TimeZone name from Microsoft TimeZone name = [{}]. Default TimeZone [{}] will be used instead.", msName, timeZone); } return timeZone; }
DateTimeAdjuster { public static String guessTimeZone(String msName) { String timeZone = "Europe/Berlin"; try { Map<String, String> microsoftTimeZones = TimeZoneUtils.createOlsonTimeZoneToMsMap(); if (microsoftTimeZones != null) { timeZone = microsoftTimeZones.entrySet().stream().filter(entry -> entry.getValue().equals(msName)).map(Map.Entry::getKey) .findFirst().orElse(timeZone); } } catch (Exception e) { LOG.warn("Cannot take Java TimeZone name from Microsoft TimeZone name = [{}]. Default TimeZone [{}] will be used instead.", msName, timeZone); } return timeZone; } }
DateTimeAdjuster { public static String guessTimeZone(String msName) { String timeZone = "Europe/Berlin"; try { Map<String, String> microsoftTimeZones = TimeZoneUtils.createOlsonTimeZoneToMsMap(); if (microsoftTimeZones != null) { timeZone = microsoftTimeZones.entrySet().stream().filter(entry -> entry.getValue().equals(msName)).map(Map.Entry::getKey) .findFirst().orElse(timeZone); } } catch (Exception e) { LOG.warn("Cannot take Java TimeZone name from Microsoft TimeZone name = [{}]. Default TimeZone [{}] will be used instead.", msName, timeZone); } return timeZone; }  }
DateTimeAdjuster { public static String guessTimeZone(String msName) { String timeZone = "Europe/Berlin"; try { Map<String, String> microsoftTimeZones = TimeZoneUtils.createOlsonTimeZoneToMsMap(); if (microsoftTimeZones != null) { timeZone = microsoftTimeZones.entrySet().stream().filter(entry -> entry.getValue().equals(msName)).map(Map.Entry::getKey) .findFirst().orElse(timeZone); } } catch (Exception e) { LOG.warn("Cannot take Java TimeZone name from Microsoft TimeZone name = [{}]. Default TimeZone [{}] will be used instead.", msName, timeZone); } return timeZone; }  static String adjustDateTimeString(String text); static String guessTimeZone(String msName); }
DateTimeAdjuster { public static String guessTimeZone(String msName) { String timeZone = "Europe/Berlin"; try { Map<String, String> microsoftTimeZones = TimeZoneUtils.createOlsonTimeZoneToMsMap(); if (microsoftTimeZones != null) { timeZone = microsoftTimeZones.entrySet().stream().filter(entry -> entry.getValue().equals(msName)).map(Map.Entry::getKey) .findFirst().orElse(timeZone); } } catch (Exception e) { LOG.warn("Cannot take Java TimeZone name from Microsoft TimeZone name = [{}]. Default TimeZone [{}] will be used instead.", msName, timeZone); } return timeZone; }  static String adjustDateTimeString(String text); static String guessTimeZone(String msName); static Logger LOG; }