author | amurillo |
Fri, 20 Apr 2012 16:23:48 -0700 | |
changeset 12384 | 55ac5f20c7bf |
parent 10138 | b7572da25d15 |
child 14787 | 54eb3f090934 |
permissions | -rw-r--r-- |
1945
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
1 |
/* |
10138 | 2 |
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. |
1945
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
4 |
* |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
8 |
* |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
13 |
* accompanied this code). |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
14 |
* |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
18 |
* |
5506 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
1945
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
22 |
*/ |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
23 |
|
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
24 |
/** |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
25 |
* @test |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
26 |
* @bug 6791927 |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
27 |
* @summary Wrong Locale in HttpCookie::expiryDate2DeltaSeconds |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
28 |
*/ |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
29 |
|
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
30 |
import java.net.*; |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
31 |
import java.util.List; |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
32 |
import java.util.Locale; |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
33 |
|
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
34 |
public class B6791927 { |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
35 |
public static final void main( String[] aaParamters ) throws Exception{ |
10138 | 36 |
Locale reservedLocale = Locale.getDefault(); |
37 |
try { |
|
38 |
// Forces a non US locale |
|
39 |
Locale.setDefault(Locale.FRANCE); |
|
40 |
List<HttpCookie> cookies = HttpCookie.parse("set-cookie: CUSTOMER=WILE_E_COYOTE; expires=Wednesday, 09-Nov-2019 23:12:40 GMT"); |
|
41 |
if (cookies == null || cookies.isEmpty()) { |
|
42 |
throw new RuntimeException("No cookie found"); |
|
1945
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
43 |
} |
10138 | 44 |
for (HttpCookie c : cookies) { |
45 |
if (c.getMaxAge() == 0) { |
|
46 |
throw new RuntimeException( |
|
47 |
"Expiration date shouldn't be 0"); |
|
48 |
} |
|
49 |
} |
|
50 |
} finally { |
|
51 |
// restore the reserved locale |
|
52 |
Locale.setDefault(reservedLocale); |
|
1945
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
53 |
} |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
54 |
} |
95b9d549a3b4
6791927: Wrong Locale in HttpCookie::expiryDate2DeltaSeconds
jccollet
parents:
diff
changeset
|
55 |
} |