< prev index next >

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

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

*** 1,7 **** /* ! * Copyright (c) 1997, 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) 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
*** 217,228 **** match(";"); } if (keyStoreUrlString == null && storePassURL != null) { throw new ParsingException(ResourcesMgr.getString ! ("keystorePasswordURL can not be specified without also " + ! "specifying keystore")); } } public void add(GrantEntry ge) { --- 217,227 ---- match(";"); } if (keyStoreUrlString == null && storePassURL != null) { throw new ParsingException(ResourcesMgr.getString ! ("keystorePasswordURL.can.not.be.specified.without.also.specifying.keystore")); } } public void add(GrantEntry ge) {
*** 355,365 **** if (peek("\"")) { keyStoreType = match("quoted string"); } else { throw new ParsingException(st.lineno(), ! ResourcesMgr.getString("expected keystore type")); } // parse keystore provider if (!peek(",")) { return; // provider optional --- 354,364 ---- if (peek("\"")) { keyStoreType = match("quoted string"); } else { throw new ParsingException(st.lineno(), ! ResourcesMgr.getString("expected.keystore.type")); } // parse keystore provider if (!peek(",")) { return; // provider optional
*** 368,378 **** if (peek("\"")) { keyStoreProvider = match("quoted string"); } else { throw new ParsingException(st.lineno(), ! ResourcesMgr.getString("expected keystore provider")); } } private void parseStorePassURL() throws ParsingException, IOException { match("keyStorePasswordURL"); --- 367,377 ---- if (peek("\"")) { keyStoreProvider = match("quoted string"); } else { throw new ParsingException(st.lineno(), ! ResourcesMgr.getString("expected.keystore.provider")); } } private void parseStorePassURL() throws ParsingException, IOException { match("keyStorePasswordURL");
*** 419,437 **** if (peekAndMatch("Codebase")) { if (e.codeBase != null) throw new ParsingException( st.lineno(), ResourcesMgr.getString ! ("multiple Codebase expressions")); e.codeBase = match("quoted string"); peekAndMatch(","); } else if (peekAndMatch("SignedBy")) { if (e.signedBy != null) throw new ParsingException( st.lineno(), ResourcesMgr.getString( ! "multiple SignedBy expressions")); e.signedBy = match("quoted string"); // verify syntax of the aliases StringTokenizer aliases = new StringTokenizer(e.signedBy, ",", true); --- 418,436 ---- if (peekAndMatch("Codebase")) { if (e.codeBase != null) throw new ParsingException( st.lineno(), ResourcesMgr.getString ! ("multiple.Codebase.expressions")); e.codeBase = match("quoted string"); peekAndMatch(","); } else if (peekAndMatch("SignedBy")) { if (e.signedBy != null) throw new ParsingException( st.lineno(), ResourcesMgr.getString( ! "multiple.SignedBy.expressions")); e.signedBy = match("quoted string"); // verify syntax of the aliases StringTokenizer aliases = new StringTokenizer(e.signedBy, ",", true);
*** 446,456 **** } if (actr <= cctr) throw new ParsingException( st.lineno(), ResourcesMgr.getString( ! "SignedBy has empty alias")); peekAndMatch(","); } else if (peekAndMatch("Principal")) { if (principals == null) { principals = new LinkedList<PrincipalEntry>(); --- 445,455 ---- } if (actr <= cctr) throw new ParsingException( st.lineno(), ResourcesMgr.getString( ! "SignedBy.has.empty.alias")); peekAndMatch(","); } else if (peekAndMatch("Principal")) { if (principals == null) { principals = new LinkedList<PrincipalEntry>();
*** 489,500 **** "has WILDCARD class but no WILDCARD name"); } throw new ParsingException (st.lineno(), ResourcesMgr.getString ! ("can not specify Principal with a " + ! "wildcard class without a wildcard name")); } } try { principalName = expand(principalName); --- 488,498 ---- "has WILDCARD class but no WILDCARD name"); } throw new ParsingException (st.lineno(), ResourcesMgr.getString ! ("can.not.specify.Principal.with.a.wildcard.class.without.a.wildcard.name")); } } try { principalName = expand(principalName);
*** 527,538 **** peekAndMatch(","); } else { throw new ParsingException(st.lineno(), ResourcesMgr.getString( ! "expected codeBase or SignedBy or " + ! "Principal")); } } if (principals != null) e.principals = principals; match("{"); --- 525,535 ---- peekAndMatch(","); } else { throw new ParsingException(st.lineno(), ResourcesMgr.getString( ! "expected.codeBase.or.SignedBy.or.Principal")); } } if (principals != null) e.principals = principals; match("{");
*** 552,562 **** match(";"); } else { throw new ParsingException(st.lineno(), ResourcesMgr.getString( ! "expected permission entry")); } } match("}"); try { --- 549,559 ---- match(";"); } else { throw new ParsingException(st.lineno(), ResourcesMgr.getString( ! "expected.permission.entry")); } } match("}"); try {
*** 725,740 **** String value = null; switch (lookahead) { case StreamTokenizer.TT_NUMBER: throw new ParsingException(st.lineno(), expect, ! ResourcesMgr.getString("number ") + String.valueOf(st.nval)); case StreamTokenizer.TT_EOF: MessageFormat form = new MessageFormat( ResourcesMgr.getString ! ("expected [expect], read [end of file]")); Object[] source = {expect}; throw new ParsingException(form.format(source)); case StreamTokenizer.TT_WORD: if (expect.equalsIgnoreCase(st.sval)) { lookahead = st.nextToken(); --- 722,737 ---- String value = null; switch (lookahead) { case StreamTokenizer.TT_NUMBER: throw new ParsingException(st.lineno(), expect, ! ResourcesMgr.getString("number.") + String.valueOf(st.nval)); case StreamTokenizer.TT_EOF: MessageFormat form = new MessageFormat( ResourcesMgr.getString ! ("expected.expect.read.end.of.file.")); Object[] source = {expect}; throw new ParsingException(form.format(source)); case StreamTokenizer.TT_WORD: if (expect.equalsIgnoreCase(st.sval)) { lookahead = st.nextToken();
*** 807,821 **** private void skipEntry() throws ParsingException, IOException { while(lookahead != ';') { switch (lookahead) { case StreamTokenizer.TT_NUMBER: throw new ParsingException(st.lineno(), ";", ! ResourcesMgr.getString("number ") + String.valueOf(st.nval)); case StreamTokenizer.TT_EOF: throw new ParsingException(ResourcesMgr.getString ! ("expected [;], read [end of file]")); default: lookahead = st.nextToken(); } } } --- 804,818 ---- private void skipEntry() throws ParsingException, IOException { while(lookahead != ';') { switch (lookahead) { case StreamTokenizer.TT_NUMBER: throw new ParsingException(st.lineno(), ";", ! ResourcesMgr.getString("number.") + String.valueOf(st.nval)); case StreamTokenizer.TT_EOF: throw new ParsingException(ResourcesMgr.getString ! ("expected.read.end.of.file.")); default: lookahead = st.nextToken(); } } }
*** 971,981 **** * @param principalName the <code>Principal</code> name. <p> */ public PrincipalEntry(String principalClass, String principalName) { if (principalClass == null || principalName == null) throw new NullPointerException(ResourcesMgr.getString( ! "null principalClass or principalName")); this.principalClass = principalClass; this.principalName = principalName; } public String getPrincipalClass() { --- 968,978 ---- * @param principalName the <code>Principal</code> name. <p> */ public PrincipalEntry(String principalClass, String principalName) { if (principalClass == null || principalName == null) throw new NullPointerException(ResourcesMgr.getString( ! "null.principalClass.or.principalName")); this.principalClass = principalClass; this.principalName = principalName; } public String getPrincipalClass() {
*** 1197,1216 **** } public ParsingException(int line, String msg) { super("line " + line + ": " + msg); MessageFormat form = new MessageFormat ! (ResourcesMgr.getString("line number: msg")); Object[] source = {new Integer(line), msg}; i18nMessage = form.format(source); } public ParsingException(int line, String expect, String actual) { super("line " + line + ": expected [" + expect + "], found [" + actual + "]"); MessageFormat form = new MessageFormat(ResourcesMgr.getString ! ("line number: expected [expect], found [actual]")); Object[] source = {new Integer(line), expect, actual}; i18nMessage = form.format(source); } public String getLocalizedMessage() { --- 1194,1213 ---- } public ParsingException(int line, String msg) { super("line " + line + ": " + msg); MessageFormat form = new MessageFormat ! (ResourcesMgr.getString("line.number.msg")); Object[] source = {new Integer(line), msg}; i18nMessage = form.format(source); } public ParsingException(int line, String expect, String actual) { super("line " + line + ": expected [" + expect + "], found [" + actual + "]"); MessageFormat form = new MessageFormat(ResourcesMgr.getString ! ("line.number.expected.expect.found.actual.")); Object[] source = {new Integer(line), expect, actual}; i18nMessage = form.format(source); } public String getLocalizedMessage() {
< prev index next >