author | weijun |
Thu, 08 Sep 2011 09:04:28 +0800 | |
changeset 10435 | e9df9d264894 |
parent 7759 | 2e1579882018 |
permissions | -rw-r--r-- |
4826
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
1 |
/* |
5506 | 2 |
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. |
4826
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
4 |
* |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
8 |
* |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
13 |
* accompanied this code). |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
14 |
* |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
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. |
|
4826
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
22 |
*/ |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
23 |
|
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
24 |
/* |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
25 |
* @test |
5939
1882d33f2c60
6968373: FontUtilities static initializer throws AccessControlException
igor
parents:
5506
diff
changeset
|
26 |
* @bug 5010310 6319835 6904882 6968373 |
4826
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
27 |
* @summary test fonts can be created in the presence of a security manager |
7759 | 28 |
* @run main FontPrivilege |
4826
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
29 |
*/ |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
30 |
|
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
31 |
import java.awt.Font; |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
32 |
|
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
33 |
public class FontPrivilege { |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
34 |
|
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
35 |
public static void main(String[] args) throws Exception { |
7759 | 36 |
System.setSecurityManager(new SecurityManager()); |
37 |
||
4826
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
38 |
new Font("Helvetica", Font.PLAIN, 12).getFamily(); |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
39 |
new Font("foo bar", Font.PLAIN, 12).getFamily(); |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
40 |
} |
878c0606a10c
6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"
rkennke
parents:
diff
changeset
|
41 |
} |