title: Memory leak on GregorianCalendar
body: <p>We are having this error and the JSP page becomes blank (white):</p>
  
  <blockquote>
    <p>Jan 9, 2013 7:30:39 PM org.apache.catalina.loader.WebappClassLoader
    clearThreadLocalMap SEVERE: The web application [/MyWebApp] created a
    ThreadLocal with key of type [net.sourceforge.jtds.jdbc.DateTime$1]
    (value [net.sourceforge.jtds.jdbc.DateTime$1@48a47]) and a value of
    type [java.util.GregorianCalendar] (value
    [java.util.GregorianCalendar[time=1357531128420,areFieldsSet=true,areAllFieldsSet=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Australia/Sydney",offset=36000000,dstSavings=3600000,useDaylight=true,transitions=142,lastRule=java.util.SimpleTimeZone[id=Australia/Sydney,offset=36000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=9,startDay=1,startDayOfWeek=1,startTime=7200000,startTimeMode=1,endMode=3,endMonth=3,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=1]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2013,MONTH=0,WEEK_OF_YEAR=2,WEEK_OF_MONTH=2,DAY_OF_MONTH=7,DAY_OF_YEAR=7,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=2,HOUR_OF_DAY=14,MINUTE=58,SECOND=48,MILLISECOND=420,ZONE_OFFSET=36000000,DST_OFFSET=3600000]])
    but failed to remove it when the web application was stopped. This is
    very likely to create a memory leak.</p>
  </blockquote>
  
  <p>Suggested solutions are:</p>
  
  <ul>
  <li><p>use new instances for each time a <code>Calendar</code> is needed or</p></li>
  <li><p>check whether some hook in <code>ResultSet.close</code> is sufficient for calling <code>ThreadLocal.remove()</code></p></li>
  </ul>
  
  <p>However, in our case we need to reproduce the error, so it is possible to test the fix, without waiting indefinitely for the error to happen again.</p>