private Permissions loadExcludedPolicy() {
Permissions result = null;
String name = getPolicyFileName(false);
FileReader reader = null;
PolicyParser parser = new PolicyParser(false);
try {
captureFileTime(false);
reader = new FileReader(name);
parser.read(reader);
} catch (java.io.FileNotFoundException fnf) {
//Just means there is no excluded Policy file, which
// is the typical case
parser = null;
} catch (java.io.IOException ioe) {
String defMsg="Error reading Policy file: "+name;
String msg=localStrings.getLocalString("pc.file_read_error",defMsg,
new Object []{name, ioe});
logger.log(Level.SEVERE,msg);
throw new RuntimeException(defMsg);
} catch ( sun.security.provider.PolicyParser.ParsingException pe) {
String defMsg="Unable to parse Policy file: "+name;
String msg=localStrings.getLocalString("pc.policy_parsing_exception",defMsg,
new Object []{name,pe});
logger.log(Level.SEVERE,msg);
throw new RuntimeException(defMsg);
} finally {
if (reader != null) {
try {
reader.close();
} catch (Exception e) {
String defMsg="Unable to close Policy file: "+name;
String msg=localStrings.getLocalString("pc.file_close_error",defMsg,
new Object []{name,e});
logger.log(Level.SEVERE,msg);
throw new RuntimeException(defMsg);
}
}
}
if (parser != null) {
Enumeration grants = parser.grantElements();
while (grants.hasMoreElements()) {
GrantEntry grant = (GrantEntry) grants.nextElement();
if (grant.codeBase != null || grant.signedBy != null ||
grant.principals.size() != 0) {
String msg=localStrings.getLocalString("pc.excluded_grant_context_ignored",