diff --git a/jdk/src/share/classes/com/sun/net/ssl/SSLPermission.java b/jdk/src/share/classes/com/sun/net/ssl/SSLPermission.java index 101dcc7af6c..2bf9233051b 100644 --- a/jdk/src/share/classes/com/sun/net/ssl/SSLPermission.java +++ b/jdk/src/share/classes/com/sun/net/ssl/SSLPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,8 +46,8 @@ import java.lang.SecurityManager; * convention follows the hierarchical property naming convention. * Also, an asterisk * may appear at the end of the name, following a ".", or by itself, to - * signify a wildcard match. For example: "foo.*" or "*" is valid, - * "*foo" or "a*b" is not valid. + * signify a wildcard match. For example: "foo.*" and "*" signify a wildcard + * match, while "*foo" and "a*b" do not. *
* The following table lists all the possible SSLPermission target names, * and for each provides a description of what the permission allows diff --git a/jdk/src/share/classes/java/lang/RuntimePermission.java b/jdk/src/share/classes/java/lang/RuntimePermission.java index eeef0b5244b..6dcbc275e9e 100644 --- a/jdk/src/share/classes/java/lang/RuntimePermission.java +++ b/jdk/src/share/classes/java/lang/RuntimePermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,8 +41,8 @@ import java.util.StringTokenizer; * naming convention follows the hierarchical property naming convention. * Also, an asterisk * may appear at the end of the name, following a ".", or by itself, to - * signify a wildcard match. For example: "loadLibrary.*" or "*" is valid, - * "*loadLibrary" or "a*b" is not valid. + * signify a wildcard match. For example: "loadLibrary.*" and "*" signify a + * wildcard match, while "*loadLibrary" and "a*b" do not. *
* The following table lists all the possible RuntimePermission target names, * and for each provides a description of what the permission allows diff --git a/jdk/src/share/classes/java/net/NetPermission.java b/jdk/src/share/classes/java/net/NetPermission.java index f22e04f717a..f11337e5b9e 100644 --- a/jdk/src/share/classes/java/net/NetPermission.java +++ b/jdk/src/share/classes/java/net/NetPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,8 +40,8 @@ import java.util.StringTokenizer; * convention follows the hierarchical property naming convention. * Also, an asterisk * may appear at the end of the name, following a ".", or by itself, to - * signify a wildcard match. For example: "foo.*" or "*" is valid, - * "*foo" or "a*b" is not valid. + * signify a wildcard match. For example: "foo.*" and "*" signify a wildcard + * match, while "*foo" and "a*b" do not. *
* The following table lists all the possible NetPermission target names, * and for each provides a description of what the permission allows diff --git a/jdk/src/share/classes/java/security/BasicPermission.java b/jdk/src/share/classes/java/security/BasicPermission.java index 08fa34c8f57..439eefa83f1 100644 --- a/jdk/src/share/classes/java/security/BasicPermission.java +++ b/jdk/src/share/classes/java/security/BasicPermission.java @@ -46,8 +46,8 @@ import java.io.IOException; * convention follows the hierarchical property naming convention. * An asterisk may appear by itself, or if immediately preceded by a "." * may appear at the end of the name, to signify a wildcard match. - * For example, "*" and "java.*" are valid, while "*java", "a*b", - * and "java*" are not valid. + * For example, "*" and "java.*" signify a wildcard match, while "*java", "a*b", + * and "java*" do not. *
* The action string (inherited from Permission) is unused.
* Thus, BasicPermission is commonly used as the base class for
diff --git a/jdk/src/share/classes/java/sql/SQLPermission.java b/jdk/src/share/classes/java/sql/SQLPermission.java
index fe5bfc5a1a1..e2207db3262 100644
--- a/jdk/src/share/classes/java/sql/SQLPermission.java
+++ b/jdk/src/share/classes/java/sql/SQLPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -49,8 +49,8 @@ import java.security.*;
* In addition, an asterisk
* may appear at the end of the name, following a ".", or by itself, to
* signify a wildcard match. For example: loadLibrary.*
- * or *
is valid,
- * but *loadLibrary
or a*b
is not valid.
+ * and *
signify a wildcard match,
+ * while *loadLibrary
and a*b
do not.
*
* The following table lists all the possible SQLPermission
target names.
* The table gives a description of what the permission allows
diff --git a/jdk/src/share/classes/java/util/PropertyPermission.java b/jdk/src/share/classes/java/util/PropertyPermission.java
index f41418e1723..7a7700a486e 100644
--- a/jdk/src/share/classes/java/util/PropertyPermission.java
+++ b/jdk/src/share/classes/java/util/PropertyPermission.java
@@ -48,8 +48,8 @@ import sun.security.util.SecurityConstants;
* convention follows the hierarchical property naming convention.
* Also, an asterisk
* may appear at the end of the name, following a ".", or by itself, to
- * signify a wildcard match. For example: "java.*" or "*" is valid,
- * "*java" or "a*b" is not valid.
+ * signify a wildcard match. For example: "java.*" and "*" signify a wildcard
+ * match, while "*java" and "a*b" do not.
*
*
* The actions to be granted are passed to the constructor in a string containing diff --git a/jdk/src/share/classes/javax/net/ssl/SSLPermission.java b/jdk/src/share/classes/javax/net/ssl/SSLPermission.java index 04ebfe1543c..bac011d6579 100644 --- a/jdk/src/share/classes/javax/net/ssl/SSLPermission.java +++ b/jdk/src/share/classes/javax/net/ssl/SSLPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,8 +37,8 @@ import java.security.*; * convention follows the hierarchical property naming convention. * Also, an asterisk * may appear at the end of the name, following a ".", or by itself, to - * signify a wildcard match. For example: "foo.*" or "*" is valid, - * "*foo" or "a*b" is not valid. + * signify a wildcard match. For example: "foo.*" and "*" signify a wildcard + * match, while "*foo" and "a*b" do not. *
* The following table lists all the possible SSLPermission target names, * and for each provides a description of what the permission allows diff --git a/jdk/test/java/security/BasicPermission/Wildcard.java b/jdk/test/java/security/BasicPermission/Wildcard.java new file mode 100644 index 00000000000..3b6d1c58eea --- /dev/null +++ b/jdk/test/java/security/BasicPermission/Wildcard.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.lang.RuntimePermission; +import java.net.NetPermission; +import java.sql.SQLPermission; +import java.util.PropertyPermission; +import javax.net.ssl.SSLPermission; + +/* + * @test + * @bug 7167056 + * @summary Check that BasicPermission subclasses don't throw exception if name + * contains wildcard character ("*") but does not signify a + * wildcard match + */ + +public class Wildcard { + + public static void main(String[] args) throws Exception { + wildcard("*java"); + wildcard("java*"); + wildcard("ja*va"); + } + + private static void wildcard(String wildcard) throws Exception { + new RuntimePermission(wildcard); + new NetPermission(wildcard); + new SQLPermission(wildcard); + new PropertyPermission(wildcard, "read"); + new SSLPermission(wildcard); + new com.sun.net.ssl.SSLPermission(wildcard); + } +}