81 |
private static final long serialVersionUID = 6279438298436773498L; |
private static final long serialVersionUID = 6279438298436773498L; |
82 |
|
|
83 |
/** |
/** |
84 |
* Create a new instance with the specified permission name. If the name |
* Create a new instance with the specified permission name. If the |
85 |
* is empty, or contains an illegal wildcard character, an exception is |
* name is empty an exception is thrown. |
|
* thrown. |
|
86 |
* |
* |
87 |
* @param name the name of this permission |
* @param name the name of this permission |
88 |
* @throws NullPointerException if name is null |
* @throws NullPointerException if name is null |
91 |
public BasicPermission(String name) |
public BasicPermission(String name) |
92 |
{ |
{ |
93 |
super(name); |
super(name); |
94 |
if (name.indexOf("*") != -1) |
|
95 |
{ |
// This routine used to check for illegal wildcards, but no such |
96 |
if ((! name.endsWith(".*") && ! name.equals("*")) |
// requirement exists in the specification and Sun's runtime |
97 |
|| name.indexOf("*") != name.lastIndexOf("*")) |
// doesn't appear to do it. |
98 |
throw new IllegalArgumentException("Bad wildcard: " + name); |
|
|
} |
|
99 |
if ("".equals(name)) |
if ("".equals(name)) |
100 |
throw new IllegalArgumentException("Empty name"); |
throw new IllegalArgumentException("Empty name"); |
101 |
} |
} |