Bug 57331 - Allow ExpiresFilter to use "year" as synonym for "years" in its configuration
Summary: Allow ExpiresFilter to use "year" as synonym for "years" in its configuration
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 7.0.57
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-08 21:37 UTC by Konstantin Kolinko
Modified: 2014-12-09 01:00 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Kolinko 2014-12-08 21:37:10 UTC
The current code is

            if ("years".equalsIgnoreCase(currentToken)) {
                durationUnit = DurationUnit.YEAR;
            } else if ("month".equalsIgnoreCase(currentToken) ||
                    "months".equalsIgnoreCase(currentToken)) {
                durationUnit = DurationUnit.MONTH;
            ...

The above if/else tree misses "year" case. All other time units have support for singular form, e.g. "months"/"month" above.

This was observed by a stackoverflow user [1]. 
The following configuration fails:

  <init-param>
   <param-name>ExpiresDefault</param-name>
   <param-value>access plus 1 year</param-value>
 </init-param>

but succeeds if one replaces s/year/years/.


[1] http://stackoverflow.com/questions/27353512/how-to-configure-expires-filter-in-tomcat-7
Comment 1 Konstantin Kolinko 2014-12-09 01:00:00 UTC
Fixed in Tomcat 7, 8, trunk. It will be in 7.0.58, 8.0.16 onwards.

(revisions 1643963, 1643964, 1643965)