< prev index next >

src/share/classes/sun/security/provider/PolicyFile.java

Print this page
rev 1461 : 6987827: security/util/Resources.java needs improvement
Reviewed-by: valeriep

*** 1,7 **** /* ! * Copyright (c) 1997, 2009, 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) 1997, 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
*** 648,658 **** PolicyParser.GrantEntry ge = enum_.nextElement(); addGrantEntry(ge, keyStore, newInfo); } } catch (PolicyParser.ParsingException pe) { MessageFormat form = new MessageFormat(ResourcesMgr.getString ! (POLICY + ": error parsing policy:\n\tmessage")); Object[] source = {policy, pe.getLocalizedMessage()}; System.err.println(form.format(source)); if (debug != null) pe.printStackTrace(); --- 648,658 ---- PolicyParser.GrantEntry ge = enum_.nextElement(); addGrantEntry(ge, keyStore, newInfo); } } catch (PolicyParser.ParsingException pe) { MessageFormat form = new MessageFormat(ResourcesMgr.getString ! (POLICY + ".error.parsing.policy.message")); Object[] source = {policy, pe.getLocalizedMessage()}; System.err.println(form.format(source)); if (debug != null) pe.printStackTrace();
*** 890,908 **** } } catch (java.lang.reflect.InvocationTargetException ite) { MessageFormat form = new MessageFormat (ResourcesMgr.getString (POLICY + ! ": error adding Permission, perm:\n\tmessage")); Object[] source = {pe.permission, ite.getTargetException().toString()}; System.err.println(form.format(source)); } catch (Exception e) { MessageFormat form = new MessageFormat (ResourcesMgr.getString (POLICY + ! ": error adding Permission, perm:\n\tmessage")); Object[] source = {pe.permission, e.toString()}; System.err.println(form.format(source)); } } --- 890,908 ---- } } catch (java.lang.reflect.InvocationTargetException ite) { MessageFormat form = new MessageFormat (ResourcesMgr.getString (POLICY + ! ".error.adding.Permission.perm.message")); Object[] source = {pe.permission, ite.getTargetException().toString()}; System.err.println(form.format(source)); } catch (Exception e) { MessageFormat form = new MessageFormat (ResourcesMgr.getString (POLICY + ! ".error.adding.Permission.perm.message")); Object[] source = {pe.permission, e.toString()}; System.err.println(form.format(source)); } }
*** 910,920 **** // No need to sync because noone has access to newInfo yet newInfo.policyEntries.add(entry); } catch (Exception e) { MessageFormat form = new MessageFormat(ResourcesMgr.getString (POLICY ! + ": error adding Entry:\n\tmessage")); Object[] source = {e.toString()}; System.err.println(form.format(source)); } if (debug != null) debug.println(); --- 910,920 ---- // No need to sync because noone has access to newInfo yet newInfo.policyEntries.add(entry); } catch (Exception e) { MessageFormat form = new MessageFormat(ResourcesMgr.getString (POLICY ! + ".error.adding.Entry.message")); Object[] source = {e.toString()}; System.err.println(form.format(source)); } if (debug != null) debug.println();
*** 1946,1974 **** } else if (prefix.equalsIgnoreCase("alias")) { // get the suffix and perform keystore alias replacement if (colonIndex == -1) { MessageFormat form = new MessageFormat (ResourcesMgr.getString ! ("alias name not provided (pe.name)")); Object[] source = {pe.name}; throw new Exception(form.format(source)); } suffix = value.substring(colonIndex+1); if ((suffix = getDN(suffix, keystore)) == null) { MessageFormat form = new MessageFormat (ResourcesMgr.getString ! ("unable to perform substitution on alias, suffix")); Object[] source = {value.substring(colonIndex+1)}; throw new Exception(form.format(source)); } sb.append(X500PRINCIPAL + " \"" + suffix + "\""); startIndex = e+2; } else { MessageFormat form = new MessageFormat (ResourcesMgr.getString ! ("substitution value, prefix, unsupported")); Object[] source = {prefix}; throw new Exception(form.format(source)); } } --- 1946,1974 ---- } else if (prefix.equalsIgnoreCase("alias")) { // get the suffix and perform keystore alias replacement if (colonIndex == -1) { MessageFormat form = new MessageFormat (ResourcesMgr.getString ! ("alias.name.not.provided.pe.name.")); Object[] source = {pe.name}; throw new Exception(form.format(source)); } suffix = value.substring(colonIndex+1); if ((suffix = getDN(suffix, keystore)) == null) { MessageFormat form = new MessageFormat (ResourcesMgr.getString ! ("unable.to.perform.substitution.on.alias.suffix")); Object[] source = {value.substring(colonIndex+1)}; throw new Exception(form.format(source)); } sb.append(X500PRINCIPAL + " \"" + suffix + "\""); startIndex = e+2; } else { MessageFormat form = new MessageFormat (ResourcesMgr.getString ! ("substitution.value.prefix.unsupported")); Object[] source = {prefix}; throw new Exception(form.format(source)); } }
*** 2199,2220 **** return codesource; } @Override public String toString(){ StringBuilder sb = new StringBuilder(); ! sb.append(ResourcesMgr.getString("(")); sb.append(getCodeSource()); sb.append("\n"); for (int j = 0; j < permissions.size(); j++) { Permission p = permissions.get(j); ! sb.append(ResourcesMgr.getString(" ")); ! sb.append(ResourcesMgr.getString(" ")); sb.append(p); ! sb.append(ResourcesMgr.getString("\n")); } ! sb.append(ResourcesMgr.getString(")")); ! sb.append(ResourcesMgr.getString("\n")); return sb.toString(); } } private static class SelfPermission extends Permission { --- 2199,2220 ---- return codesource; } @Override public String toString(){ StringBuilder sb = new StringBuilder(); ! sb.append(ResourcesMgr.getString("LPARAM")); sb.append(getCodeSource()); sb.append("\n"); for (int j = 0; j < permissions.size(); j++) { Permission p = permissions.get(j); ! sb.append(ResourcesMgr.getString("SPACE")); ! sb.append(ResourcesMgr.getString("SPACE")); sb.append(p); ! sb.append(ResourcesMgr.getString("NEWLINE")); } ! sb.append(ResourcesMgr.getString("RPARAM")); ! sb.append(ResourcesMgr.getString("NEWLINE")); return sb.toString(); } } private static class SelfPermission extends Permission {
*** 2267,2277 **** Certificate certs[]) { super(type); if (type == null) { throw new NullPointerException ! (ResourcesMgr.getString("type can't be null")); } this.type = type; this.name = name; this.actions = actions; if (certs != null) { --- 2267,2277 ---- Certificate certs[]) { super(type); if (type == null) { throw new NullPointerException ! (ResourcesMgr.getString("type.can.t.be.null")); } this.type = type; this.name = name; this.actions = actions; if (certs != null) {
< prev index next >