FULL PRODUCT VERSION :
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) Server VM (build 25.0-b70, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux funikov 2.6.37.6-24-desktop #1 SMP PREEMPT 2012-10-18 22:36:08 +0200 i686 i686 i386 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
SimpleDateFormat with "stand-alone" month format "LLLL yyyy" and locate ru_RU throw java.text.ParseExceptio when parse the valid date string "Сентябрь 2015".
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
context sensitive month format: сентября 2015
stand-alone month format: Сентябрь 2015
ACTUAL -
context sensitive month format: сентября 2015
окт 01, 2015 9:51:49 AM ru.kih.test.month.stand.alone.TestMonthStandAlone main
SEVERE: null
java.text.ParseException: Unparseable date: "Сентябрь 2015"
at java.text.DateFormat.parse(DateFormat.java:366)
at ru.kih.test.month.stand.alone.TestMonthStandAlone.main(TestMonthStandAlone.java:19)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
окт 01, 2015 9:51:49 AM ru.kih.test.month.stand.alone.TestMonthStandAlone main
SEVERE: null
java.text.ParseException: Unparseable date: "Сентябрь 2015"
at java.text.DateFormat.parse(DateFormat.java:366)
at ru.kih.test.month.stand.alone.TestMonthStandAlone.main(TestMonthStandAlone.java:19)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test.month.stand.alone;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
public class TestMonthStandAlone {
public static void main(String[] args) {
final SimpleDateFormat contextSensitiveFormat = new SimpleDateFormat("MMMM yyyy");
final SimpleDateFormat standaloneFormat = new SimpleDateFormat("LLLL yyyy");
try {
final Date dateFromContextSensitiveFormat = contextSensitiveFormat.parse("сентября 2015");
System.out.println("context sensitive month format: " + contextSensitiveFormat.format(dateFromContextSensitiveFormat));
final Date dateFromStandaloneFormat = standaloneFormat.parse("Сентябрь 2015");
System.out.println("stand-alone month format: " + standaloneFormat.format(dateFromStandaloneFormat));
} catch (ParseException ex) {
Logger.getLogger(TestMonthStandAlone.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
SimpleDateFormat.subParse(String text, int start, int patternCharIndex, int count, boolean obeyCount, boolean[] ambiguousYear, ParsePosition origPos, boolean useFollowingMinusSignAsDelimiter, CalendarBuilder calb) method should handle patternCharIndex == PATTERN_MONTH_STANDALONE well as a format patternCharIndex == PATTERN_MONTH
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) Server VM (build 25.0-b70, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux funikov 2.6.37.6-24-desktop #1 SMP PREEMPT 2012-10-18 22:36:08 +0200 i686 i686 i386 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
SimpleDateFormat with "stand-alone" month format "LLLL yyyy" and locate ru_RU throw java.text.ParseExceptio when parse the valid date string "Сентябрь 2015".
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
context sensitive month format: сентября 2015
stand-alone month format: Сентябрь 2015
ACTUAL -
context sensitive month format: сентября 2015
окт 01, 2015 9:51:49 AM ru.kih.test.month.stand.alone.TestMonthStandAlone main
SEVERE: null
java.text.ParseException: Unparseable date: "Сентябрь 2015"
at java.text.DateFormat.parse(DateFormat.java:366)
at ru.kih.test.month.stand.alone.TestMonthStandAlone.main(TestMonthStandAlone.java:19)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
окт 01, 2015 9:51:49 AM ru.kih.test.month.stand.alone.TestMonthStandAlone main
SEVERE: null
java.text.ParseException: Unparseable date: "Сентябрь 2015"
at java.text.DateFormat.parse(DateFormat.java:366)
at ru.kih.test.month.stand.alone.TestMonthStandAlone.main(TestMonthStandAlone.java:19)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test.month.stand.alone;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
public class TestMonthStandAlone {
public static void main(String[] args) {
final SimpleDateFormat contextSensitiveFormat = new SimpleDateFormat("MMMM yyyy");
final SimpleDateFormat standaloneFormat = new SimpleDateFormat("LLLL yyyy");
try {
final Date dateFromContextSensitiveFormat = contextSensitiveFormat.parse("сентября 2015");
System.out.println("context sensitive month format: " + contextSensitiveFormat.format(dateFromContextSensitiveFormat));
final Date dateFromStandaloneFormat = standaloneFormat.parse("Сентябрь 2015");
System.out.println("stand-alone month format: " + standaloneFormat.format(dateFromStandaloneFormat));
} catch (ParseException ex) {
Logger.getLogger(TestMonthStandAlone.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
SimpleDateFormat.subParse(String text, int start, int patternCharIndex, int count, boolean obeyCount, boolean[] ambiguousYear, ParsePosition origPos, boolean useFollowingMinusSignAsDelimiter, CalendarBuilder calb) method should handle patternCharIndex == PATTERN_MONTH_STANDALONE well as a format patternCharIndex == PATTERN_MONTH