< prev index next >
src/share/classes/com/sun/security/auth/PolicyFile.java
Print this page
rev 1461 : 6987827: security/util/Resources.java needs improvement
Reviewed-by: valeriep
*** 1,7 ****
/*
! * Copyright (c) 1999, 2006, 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. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1999, 2010, 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. Oracle designates this
*** 490,502 ****
PolicyParser.GrantEntry ge = enum_.nextElement();
addGrantEntry(ge, keyStore);
}
} catch (PolicyParser.ParsingException pe) {
System.err.println(AUTH_POLICY +
! rb.getString(": error parsing ") + policy);
System.err.println(AUTH_POLICY +
! rb.getString(": ") +
pe.getMessage());
if (debug != null)
pe.printStackTrace();
} catch (Exception e) {
--- 490,502 ----
PolicyParser.GrantEntry ge = enum_.nextElement();
addGrantEntry(ge, keyStore);
}
} catch (PolicyParser.ParsingException pe) {
System.err.println(AUTH_POLICY +
! rb.getString(".error.parsing.") + policy);
System.err.println(AUTH_POLICY +
! rb.getString("COLON") +
pe.getMessage());
if (debug != null)
pe.printStackTrace();
} catch (Exception e) {
*** 635,664 ****
}
}
} catch (java.lang.reflect.InvocationTargetException ite) {
System.err.println
(AUTH_POLICY +
! rb.getString(": error adding Permission ") +
pe.permission +
! rb.getString(" ") +
ite.getTargetException());
} catch (Exception e) {
System.err.println
(AUTH_POLICY +
! rb.getString(": error adding Permission ") +
pe.permission +
! rb.getString(" ") +
e);
}
}
policyEntries.addElement(entry);
} catch (Exception e) {
System.err.println
(AUTH_POLICY +
! rb.getString(": error adding Entry ") +
ge +
! rb.getString(" ") +
e);
}
if (debug != null)
debug.println();
--- 635,664 ----
}
}
} catch (java.lang.reflect.InvocationTargetException ite) {
System.err.println
(AUTH_POLICY +
! rb.getString(".error.adding.Permission.") +
pe.permission +
! rb.getString("SPACE") +
ite.getTargetException());
} catch (Exception e) {
System.err.println
(AUTH_POLICY +
! rb.getString(".error.adding.Permission.") +
pe.permission +
! rb.getString("SPACE") +
e);
}
}
policyEntries.addElement(entry);
} catch (Exception e) {
System.err.println
(AUTH_POLICY +
! rb.getString(".error.adding.Entry.") +
ge +
! rb.getString("SPACE") +
e);
}
if (debug != null)
debug.println();
*** 1375,1396 ****
return this.codesource;
}
public String toString(){
StringBuffer sb = new StringBuffer();
! sb.append(rb.getString("("));
sb.append(getCodeSource());
sb.append("\n");
for (int j = 0; j < permissions.size(); j++) {
Permission p = permissions.elementAt(j);
! sb.append(rb.getString(" "));
! sb.append(rb.getString(" "));
sb.append(p);
! sb.append(rb.getString("\n"));
}
! sb.append(rb.getString(")"));
! sb.append(rb.getString("\n"));
return sb.toString();
}
}
}
--- 1375,1396 ----
return this.codesource;
}
public String toString(){
StringBuffer sb = new StringBuffer();
! sb.append(rb.getString("LPARAM"));
sb.append(getCodeSource());
sb.append("\n");
for (int j = 0; j < permissions.size(); j++) {
Permission p = permissions.elementAt(j);
! sb.append(rb.getString("SPACE"));
! sb.append(rb.getString("SPACE"));
sb.append(p);
! sb.append(rb.getString("NEWLINE"));
}
! sb.append(rb.getString("RPARAM"));
! sb.append(rb.getString("NEWLINE"));
return sb.toString();
}
}
}
*** 1417,1427 ****
public void add(Permission permission) {
if (isReadOnly())
throw new SecurityException
(PolicyFile.rb.getString
! ("attempt to add a Permission to a readonly PermissionCollection"));
if (perms == null) {
if (additionalPerms == null)
additionalPerms = new Vector<Permission>();
additionalPerms.add(permission);
--- 1417,1427 ----
public void add(Permission permission) {
if (isReadOnly())
throw new SecurityException
(PolicyFile.rb.getString
! ("attempt.to.add.a.Permission.to.a.readonly.PermissionCollection"));
if (perms == null) {
if (additionalPerms == null)
additionalPerms = new Vector<Permission>();
additionalPerms.add(permission);
< prev index next >