author | duke |
Wed, 05 Jul 2017 17:14:19 +0200 | |
changeset 5570 | bfed772dd989 |
parent 5506 | 202f599c92aa |
child 7172 | 01308fd663b3 |
permissions | -rw-r--r-- |
4812
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
1 |
/* |
5506 | 2 |
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. |
4812
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
4 |
* |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
8 |
* |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
13 |
* accompanied this code). |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
14 |
* |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
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. |
|
4812
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
22 |
*/ |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
23 |
/* |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
24 |
* @test |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
25 |
* @bug 6919610 |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
26 |
* @summary KeyTabInputStream uses static field for per-instance value |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
27 |
*/ |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
28 |
import sun.security.krb5.PrincipalName; |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
29 |
import sun.security.krb5.internal.ktab.KeyTab; |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
30 |
|
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
31 |
public class KeyTabIndex { |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
32 |
public static void main(String[] args) throws Exception { |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
33 |
KeyTab kt = KeyTab.create("ktab"); |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
34 |
// Two entries with very different length, so that it's easy to |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
35 |
// observice the abnormal change of "index" field. |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
36 |
kt.addEntry(new PrincipalName( |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
37 |
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@A"), |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
38 |
"x".toCharArray(), 1); |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
39 |
kt.addEntry(new PrincipalName("a@A"), "x".toCharArray(), 1); |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
40 |
kt.save(); |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
41 |
Runnable t = new Runnable() { |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
42 |
@Override |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
43 |
public void run() { |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
44 |
KeyTab.getInstance("ktab").getClass(); |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
45 |
} |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
46 |
}; |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
47 |
KeyTab.refresh(); |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
48 |
for (int i=0; i<10; i++) { |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
49 |
new Thread(t).start(); |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
50 |
} |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
51 |
} |
c3da56ecc260
6919610: KeyTabInputStream uses static field for per-instance value
weijun
parents:
diff
changeset
|
52 |
} |