332179 Fixed formatting of negative dates
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2606 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
73a36e8f58
commit
176876039c
|
@ -1,3 +1,8 @@
|
|||
|
||||
jetty-7.2.3-SNAPSHOT
|
||||
|
||||
+ 332179 Fixed formatting of negative dates
|
||||
|
||||
jetty-7.2.2.v20101205 5 December 2010
|
||||
+ JETTY-1308 327109 (re)fixed AJP handling of empty packets
|
||||
+ 331703 Fixed failing OSGI test TestJettyOSGiBootWithJsp.java on MacOSX
|
||||
|
|
|
@ -92,11 +92,9 @@ public class HttpFields
|
|||
int century = year / 100;
|
||||
year = year % 100;
|
||||
|
||||
int epoch = (int) ((date / 1000) % (60 * 60 * 24));
|
||||
int seconds = epoch % 60;
|
||||
epoch = epoch / 60;
|
||||
int minutes = epoch % 60;
|
||||
int hours = epoch / 60;
|
||||
int hours = gc.get(Calendar.HOUR_OF_DAY);
|
||||
int minutes = gc.get(Calendar.MINUTE);
|
||||
int seconds = gc.get(Calendar.SECOND);
|
||||
|
||||
buf.append(DAYS[day_of_week]);
|
||||
buf.append(',');
|
||||
|
|
|
@ -456,6 +456,24 @@ public class HttpFieldsTest
|
|||
assertEquals("Fri, 31 Dec 1999 23:59:59 GMT",fields.getStringField("D2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNegDateFields() throws Exception
|
||||
{
|
||||
HttpFields fields = new HttpFields();
|
||||
|
||||
fields.putDateField("Dzero",0);
|
||||
assertEquals("Thu, 01 Jan 1970 00:00:00 GMT",fields.getStringField("Dzero"));
|
||||
|
||||
fields.putDateField("Dminus",-1);
|
||||
assertEquals("Wed, 31 Dec 1969 23:59:59 GMT",fields.getStringField("Dminus"));
|
||||
|
||||
fields.putDateField("Dminus",-1000);
|
||||
assertEquals("Wed, 31 Dec 1969 23:59:59 GMT",fields.getStringField("Dminus"));
|
||||
|
||||
fields.putDateField("Dancient",Long.MIN_VALUE);
|
||||
assertEquals("Sun, 02 Dec 55 16:47:04 GMT",fields.getStringField("Dancient"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLongFields() throws Exception
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue