commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominik Stadler (JIRA)" <>
Subject [jira] [Created] (LANG-1192) FastDateFormat does not support the week-year component (uppercase 'Y')
Date Thu, 10 Dec 2015 08:16:10 GMT
Dominik Stadler created LANG-1192:

             Summary: FastDateFormat does not support the week-year component (uppercase 'Y')
                 Key: LANG-1192
             Project: Commons Lang
          Issue Type: Bug
          Components: lang.time.*
    Affects Versions: 3.5
            Reporter: Dominik Stadler

The Java SimpleDateFormat supports two year-components, 'y' for normal year and 'Y' for 'Week
year', see

However when we try to use FastDateFormat to parse a format which uses the week-year, it fails
with an exception

java.lang.IllegalArgumentException: Illegal pattern component: YYYY
	at org.apache.commons.lang3.time.FastDatePrinter.parsePattern(
	at org.apache.commons.lang3.time.FastDatePrinter.init(
	at org.apache.commons.lang3.time.FastDatePrinter.<init>(
	at org.apache.commons.lang3.time.FastDateFormat.<init>(
	at org.apache.commons.lang3.time.FastDateFormat.<init>(
	at org.apache.commons.lang3.time.FastDateFormat$1.createInstance(
	at org.apache.commons.lang3.time.FastDateFormat$1.createInstance(
	at org.apache.commons.lang3.time.FormatCache.getInstance(
	at org.apache.commons.lang3.time.FastDateFormat.getInstance(

Simple unit test to reproduce this:

    public void testCommonsLang() {
    	Date date = new Date();

    	Format dateFormat = new SimpleDateFormat("YYYY");

        dateFormat = FastDateFormat.getInstance("YYYY");

This message was sent by Atlassian JIRA

View raw message