Explicit conversion to Integer; save the value for use later

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1388052 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2012-09-20 14:51:18 +00:00
parent 7be7d80dfe
commit 20295a04b9
1 changed files with 3 additions and 2 deletions

View File

@ -355,7 +355,8 @@ public class FastDateParser implements DateParser, Serializable {
* @return A sorted array of the field key / value pairs
*/
KeyValue[] getDisplayNames(int field) {
KeyValue[] fieldKeyValues= nameValues.get(field);
Integer fieldInt = Integer.valueOf(field);
KeyValue[] fieldKeyValues= nameValues.get(fieldInt);
if(fieldKeyValues==null) {
DateFormatSymbols symbols= new DateFormatSymbols(locale);
switch(field) {
@ -374,7 +375,7 @@ public class FastDateParser implements DateParser, Serializable {
default:
throw new IllegalArgumentException("Invalid field value "+field);
}
KeyValue[] prior = nameValues.putIfAbsent(field, fieldKeyValues);
KeyValue[] prior = nameValues.putIfAbsent(fieldInt, fieldKeyValues);
if(prior!=null) {
fieldKeyValues= prior;
}