BasicPermission.java: Don't check wildcards.

2004-08-04  Andrew Haley  <aph@redhat.com>

        * java/security/BasicPermission.java: Don't check wildcards.

From-SVN: r85608
This commit is contained in:
Andrew Haley 2004-08-05 17:51:11 +00:00 committed by Andrew Haley
parent d279700a68
commit 26be638d67
2 changed files with 11 additions and 9 deletions

View File

@ -1,3 +1,7 @@
2004-08-04 Andrew Haley <aph@redhat.com>
* java/security/BasicPermission.java: Don't check wildcards.
2004-08-04 Thomas Fitzsimmons <fitzsim@redhat.com>
Michael Koch <konqueror@gmx.de>

View File

@ -80,9 +80,8 @@ public abstract class BasicPermission extends Permission
private static final long serialVersionUID = 6279438298436773498L;
/**
* Create a new instance with the specified permission name. If the name
* is empty, or contains an illegal wildcard character, an exception is
* thrown.
* Create a new instance with the specified permission name. If the
* name is empty an exception is thrown.
*
* @param name the name of this permission
* @throws NullPointerException if name is null
@ -91,12 +90,11 @@ public abstract class BasicPermission extends Permission
public BasicPermission(String name)
{
super(name);
if (name.indexOf("*") != -1)
{
if ((! name.endsWith(".*") && ! name.equals("*"))
|| name.indexOf("*") != name.lastIndexOf("*"))
throw new IllegalArgumentException("Bad wildcard: " + name);
}
// This routine used to check for illegal wildcards, but no such
// requirement exists in the specification and Sun's runtime
// doesn't appear to do it.
if ("".equals(name))
throw new IllegalArgumentException("Empty name");
}