home *** CD-ROM | disk | FTP | other *** search
- package java.security;
-
- import java.io.IOException;
- import java.io.ObjectInputStream;
- import java.io.Serializable;
-
- public abstract class BasicPermission extends Permission implements Serializable {
- private transient boolean wildcard;
- private transient String path;
-
- private void init(String var1) {
- if (var1 == null) {
- throw new NullPointerException("name can't be null");
- } else if (var1.equals("")) {
- throw new IllegalArgumentException("name can't be empty");
- } else {
- if (!var1.endsWith(".*") && !var1.equals("*")) {
- this.path = var1;
- } else {
- this.wildcard = true;
- if (var1.length() == 1) {
- this.path = "";
- } else {
- this.path = var1.substring(0, var1.length() - 1);
- }
- }
-
- }
- }
-
- public BasicPermission(String var1) {
- super(var1);
- this.init(var1);
- }
-
- public BasicPermission(String var1, String var2) {
- super(var1);
- this.init(var1);
- }
-
- public boolean implies(Permission var1) {
- if (var1 != null && var1.getClass() == this.getClass()) {
- BasicPermission var2 = (BasicPermission)var1;
- if (this.wildcard) {
- if (var2.wildcard) {
- return var2.path.startsWith(this.path);
- } else {
- return var2.path.length() > this.path.length() && var2.path.startsWith(this.path);
- }
- } else {
- return var2.wildcard ? false : this.path.equals(var2.path);
- }
- } else {
- return false;
- }
- }
-
- public boolean equals(Object var1) {
- if (var1 == this) {
- return true;
- } else if (var1 != null && var1.getClass() == this.getClass()) {
- BasicPermission var2 = (BasicPermission)var1;
- return ((Permission)this).getName().equals(((Permission)var2).getName());
- } else {
- return false;
- }
- }
-
- public int hashCode() {
- return ((Permission)this).getName().hashCode();
- }
-
- public String getActions() {
- return "";
- }
-
- public PermissionCollection newPermissionCollection() {
- return new BasicPermissionCollection();
- }
-
- private synchronized void readObject(ObjectInputStream var1) throws IOException, ClassNotFoundException {
- var1.defaultReadObject();
- this.init(((Permission)this).getName());
- }
- }
-