< prev index next >

src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 83,93 **** import java.time.LocalDateTime; import java.time.LocalTime; import java.time.ZoneId; import java.time.ZoneOffset; import java.time.chrono.ChronoLocalDate; - import java.time.chrono.ChronoLocalDateTime; import java.time.chrono.Chronology; import java.time.chrono.Era; import java.time.chrono.IsoChronology; import java.time.format.DateTimeTextProvider.LocaleStore; import java.time.temporal.ChronoField; --- 83,92 ----
*** 120,130 **** import java.util.concurrent.ConcurrentMap; import sun.text.spi.JavaTimeDateTimePatternProvider; import sun.util.locale.provider.CalendarDataUtility; import sun.util.locale.provider.LocaleProviderAdapter; - import sun.util.locale.provider.LocaleResources; import sun.util.locale.provider.TimeZoneNameUtility; /** * Builder to create date-time formatters. * <p> --- 119,128 ----
*** 3869,3879 **** public boolean format(DateTimePrintContext context, StringBuilder buf) { Long offsetSecs = context.getValue(OFFSET_SECONDS); if (offsetSecs == null) { return false; } ! String gmtText = "GMT"; // TODO: get localized version of 'GMT' buf.append(gmtText); int totalSecs = Math.toIntExact(offsetSecs); if (totalSecs != 0) { int absHours = Math.abs((totalSecs / 3600) % 100); // anything larger than 99 silently dropped int absMinutes = Math.abs((totalSecs / 60) % 60); --- 3867,3881 ---- public boolean format(DateTimePrintContext context, StringBuilder buf) { Long offsetSecs = context.getValue(OFFSET_SECONDS); if (offsetSecs == null) { return false; } ! String key = "timezone.gmtZeroFormat"; ! String gmtText = DateTimeTextProvider.getLocalizedResource(key, context.getLocale()); ! if(gmtText == null) { ! gmtText = "GMT"; // Default to "GMT" ! } buf.append(gmtText); int totalSecs = Math.toIntExact(offsetSecs); if (totalSecs != 0) { int absHours = Math.abs((totalSecs / 3600) % 100); // anything larger than 99 silently dropped int absMinutes = Math.abs((totalSecs / 60) % 60);
*** 3915,3925 **** @Override public int parse(DateTimeParseContext context, CharSequence text, int position) { int pos = position; int end = text.length(); ! String gmtText = "GMT"; // TODO: get localized version of 'GMT' if (!context.subSequenceEquals(text, pos, gmtText, 0, gmtText.length())) { return ~position; } pos += gmtText.length(); // parse normal plus/minus offset --- 3917,3931 ---- @Override public int parse(DateTimeParseContext context, CharSequence text, int position) { int pos = position; int end = text.length(); ! String key = "timezone.gmtZeroFormat"; ! String gmtText = DateTimeTextProvider.getLocalizedResource(key, context.getLocale()); ! if(gmtText == null) { ! gmtText = "GMT"; // Default to "GMT" ! } if (!context.subSequenceEquals(text, pos, gmtText, 0, gmtText.length())) { return ~position; } pos += gmtText.length(); // parse normal plus/minus offset
< prev index next >