--- old/src/java.base/share/classes/java/text/SimpleDateFormat.java 2019-01-16 14:08:51.703003721 -0800 +++ new/src/java.base/share/classes/java/text/SimpleDateFormat.java 2019-01-16 14:08:50.477978048 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -1189,7 +1189,7 @@ } break; - case PATTERN_MONTH: // 'M' (context seinsive) + case PATTERN_MONTH: // 'M' (context sensitive) if (useDateFormatSymbols) { String[] months; if (count >= 4) { @@ -2033,7 +2033,7 @@ return index; } } else { - Map map = getDisplayNamesMap(field, locale); + Map map = getDisplayContextNamesMap(field, locale); if ((index = matchString(text, start, field, map, calb)) > 0) { return index; } @@ -2449,6 +2449,19 @@ return map; } + // for 'M' pattern only + private Map getDisplayContextNamesMap(int field, Locale locale) { + Map map = calendar.getDisplayNames(field, + Calendar.SHORT_FORMAT | (forceStandaloneForm ? 0x8000 : 0), locale); + // Get LONG styles + Map m = calendar.getDisplayNames(field, + Calendar.LONG_FORMAT | (forceStandaloneForm ? 0x8000 : 0), locale); + if (m != null) { + map.putAll(m); + } + return map; + } + /** * After reading an object from the input stream, the format * pattern in the object is verified.