--- a/jdk/src/share/classes/com/sun/net/ssl/SSLPermission.java Mon Nov 26 15:54:39 2012 +0400
+++ b/jdk/src/share/classes/com/sun/net/ssl/SSLPermission.java Mon Nov 26 08:34:25 2012 -0500
@@ -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 @@
* 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.
* <P>
* The following table lists all the possible SSLPermission target names,
* and for each provides a description of what the permission allows
--- a/jdk/src/share/classes/java/lang/RuntimePermission.java Mon Nov 26 15:54:39 2012 +0400
+++ b/jdk/src/share/classes/java/lang/RuntimePermission.java Mon Nov 26 08:34:25 2012 -0500
@@ -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 @@
* 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.
* <P>
* The following table lists all the possible RuntimePermission target names,
* and for each provides a description of what the permission allows
--- a/jdk/src/share/classes/java/net/NetPermission.java Mon Nov 26 15:54:39 2012 +0400
+++ b/jdk/src/share/classes/java/net/NetPermission.java Mon Nov 26 08:34:25 2012 -0500
@@ -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 @@
* 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.
* <P>
* The following table lists all the possible NetPermission target names,
* and for each provides a description of what the permission allows
--- a/jdk/src/share/classes/java/security/BasicPermission.java Mon Nov 26 15:54:39 2012 +0400
+++ b/jdk/src/share/classes/java/security/BasicPermission.java Mon Nov 26 08:34:25 2012 -0500
@@ -46,8 +46,8 @@
* 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.
* <P>
* The action string (inherited from Permission) is unused.
* Thus, BasicPermission is commonly used as the base class for
--- a/jdk/src/share/classes/java/sql/SQLPermission.java Mon Nov 26 15:54:39 2012 +0400
+++ b/jdk/src/share/classes/java/sql/SQLPermission.java Mon Nov 26 08:34:25 2012 -0500
@@ -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 @@
* In addition, an asterisk
* may appear at the end of the name, following a ".", or by itself, to
* signify a wildcard match. For example: <code>loadLibrary.*</code>
- * or <code>*</code> is valid,
- * but <code>*loadLibrary</code> or <code>a*b</code> is not valid.
+ * and <code>*</code> signify a wildcard match,
+ * while <code>*loadLibrary</code> and <code>a*b</code> do not.
* <P>
* The following table lists all the possible <code>SQLPermission</code> target names.
* The table gives a description of what the permission allows
--- a/jdk/src/share/classes/java/util/PropertyPermission.java Mon Nov 26 15:54:39 2012 +0400
+++ b/jdk/src/share/classes/java/util/PropertyPermission.java Mon Nov 26 08:34:25 2012 -0500
@@ -48,8 +48,8 @@
* 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.
* <P>
* <P>
* The actions to be granted are passed to the constructor in a string containing
--- a/jdk/src/share/classes/javax/net/ssl/SSLPermission.java Mon Nov 26 15:54:39 2012 +0400
+++ b/jdk/src/share/classes/javax/net/ssl/SSLPermission.java Mon Nov 26 08:34:25 2012 -0500
@@ -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 @@
* 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.
* <P>
* The following table lists all the possible SSLPermission target names,
* and for each provides a description of what the permission allows
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/BasicPermission/Wildcard.java Mon Nov 26 08:34:25 2012 -0500
@@ -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);
+ }
+}