From 86f8cd7460ce61db93f7f60e46c801263b6527d9 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Tue, 11 Dec 2007 18:13:00 +0000 Subject: [PATCH] Ain't generics fun? git-svn-id: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk@603319 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/http/impl/cookie/DateUtils.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/module-client/src/main/java/org/apache/http/impl/cookie/DateUtils.java b/module-client/src/main/java/org/apache/http/impl/cookie/DateUtils.java index be471a5d0..28338dc67 100644 --- a/module-client/src/main/java/org/apache/http/impl/cookie/DateUtils.java +++ b/module-client/src/main/java/org/apache/http/impl/cookie/DateUtils.java @@ -32,6 +32,7 @@ package org.apache.http.impl.cookie; import java.lang.ref.SoftReference; +import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; @@ -213,10 +214,12 @@ public final class DateUtils { */ final static class DateFormatHolder { - private static final ThreadLocal THREADLOCAL_FORMATS = new ThreadLocal() { + private static final ThreadLocal>> + THREADLOCAL_FORMATS = new ThreadLocal>>() { - protected Object initialValue() { - return new SoftReference(new HashMap()); + protected SoftReference> initialValue() { + return new SoftReference>( + new HashMap()); } }; @@ -234,11 +237,11 @@ public final class DateUtils { * different pattern. */ public static SimpleDateFormat formatFor(String pattern) { - SoftReference ref = (SoftReference) THREADLOCAL_FORMATS.get(); - Map formats = (Map) ref.get(); + SoftReference> ref = THREADLOCAL_FORMATS.get(); + Map formats = ref.get(); if (formats == null) { - formats = new HashMap(); - THREADLOCAL_FORMATS.set(new SoftReference(formats)); + formats = new HashMap(); + THREADLOCAL_FORMATS.set(new SoftReference>(formats)); } SimpleDateFormat format = (SimpleDateFormat) formats.get(pattern);