@@ -27,19 +27,6 @@ public class PolicyParser {
2727
2828 private StreamTokenizer streamTokenizer ;
2929 private int nextToken ;
30- private boolean expandProp = false ;
31-
32- private String expand (String value ) throws PropertyExpander .ExpandException {
33- return expand (value , false );
34- }
35-
36- private String expand (String value , boolean encodeURL ) throws PropertyExpander .ExpandException {
37- if (!expandProp ) {
38- return value ;
39- } else {
40- return PropertyExpander .expand (value , encodeURL );
41- }
42- }
4330
4431 /**
4532 * Creates a PolicyParser object.
@@ -49,22 +36,17 @@ public PolicyParser() {
4936 grantEntries = new Vector <>();
5037 }
5138
52- public PolicyParser (boolean expandProp ) {
53- this ();
54- this .expandProp = expandProp ;
55- }
56-
5739 /**
5840 * Reads a policy configuration into the Policy object using a
5941 * Reader object.
6042 *
6143 * @param policy the policy Reader object.
6244 *
6345 * @exception ParsingException if the policy configuration contains
64- * a syntax error.
46+ * a syntax error.
6547 *
66- * @exception IOException if an error occurs while reading the policy
67- * configuration.
48+ * @exception IOException if an error occurs while reading the policy
49+ * configuration.
6850 */
6951
7052 public void read (Reader policy ) throws ParsingException , IOException {
@@ -74,17 +56,17 @@ public void read(Reader policy) throws ParsingException, IOException {
7456
7557 /*
7658 * Configure the stream tokenizer:
77- * Recognize strings between "..."
78- * Don't convert words to lowercase
79- * Recognize both C-style and C++-style comments
80- * Treat end-of-line as white space, not as a token
59+ * Recognize strings between "..."
60+ * Don't convert words to lowercase
61+ * Recognize both C-style and C++-style comments
62+ * Treat end-of-line as white space, not as a token
8163 */
8264 streamTokenizer = Tokenizer .configureTokenizer (policy );
8365
8466 /*
85- * The main parsing loop. The loop is executed once
86- * for each entry in the config file. The entries
87- * are delimited by semicolons. Once we've read in
67+ * The main parsing loop. The loop is executed once
68+ * for each entry in the config file. The entries
69+ * are delimited by semicolons. Once we've read in
8870 * the information for an entry, go ahead and try to
8971 * add it to the policy vector.
9072 *
@@ -223,34 +205,25 @@ private GrantEntry parseGrantEntry() throws ParsingException, IOException {
223205
224206 while (!peekTokenOnMatch ("}" )) {
225207 if (peekTokenOnMatch ("Permission" )) {
226- try {
227- PermissionEntry pe = parsePermissionEntry ();
228- e .add (pe );
229- } catch (PropertyExpander .ExpandException peee ) {
230- skipEntry (); // BugId 4219343
231- }
208+
209+ PermissionEntry pe = parsePermissionEntry ();
210+ e .add (pe );
211+
232212 consumeTokenOnMatch (";" );
233213 } else {
234214 throw new ParsingException (streamTokenizer .lineno (), "Expected permission entry" );
235215 }
236216 }
237217 consumeTokenOnMatch ("}" );
238218
239- try {
240- if (e .codeBase != null ) {
241- e .codeBase = expand (e .codeBase , true ).replace (File .separatorChar , '/' );
242- }
243- } catch (PropertyExpander .ExpandException peee ) {
244- return null ;
219+ if (e .codeBase != null ) {
220+ e .codeBase = e .codeBase .replace (File .separatorChar , '/' );
245221 }
246222
247223 return (ignoreEntry ) ? null : e ;
248224 }
249225
250- /**
251- * parse a Permission entry
252- */
253- private PermissionEntry parsePermissionEntry () throws ParsingException , IOException , PropertyExpander .ExpandException {
226+ private PermissionEntry parsePermissionEntry () throws ParsingException , IOException {
254227 PermissionEntry e = new PermissionEntry ();
255228
256229 // Permission
@@ -259,7 +232,7 @@ private PermissionEntry parsePermissionEntry() throws ParsingException, IOExcept
259232
260233 if (peekTokenOnMatch ("\" " )) {
261234 // Permission name
262- e .name = expand ( consumeTokenOnMatch ("quoted string" ) );
235+ e .name = consumeTokenOnMatch ("quoted string" );
263236 }
264237
265238 if (!peekTokenOnMatch ("," )) {
@@ -268,7 +241,7 @@ private PermissionEntry parsePermissionEntry() throws ParsingException, IOExcept
268241 consumeTokenOnMatch ("," );
269242
270243 if (peekTokenOnMatch ("\" " )) {
271- e .action = expand ( consumeTokenOnMatch ("quoted string" ) );
244+ e .action = consumeTokenOnMatch ("quoted string" );
272245 if (!peekTokenOnMatch ("," )) {
273246 return e ;
274247 }
@@ -455,12 +428,14 @@ public boolean equals(Object obj) {
455428 }
456429
457430 if (this .name == null ) {
431+
458432 if (that .name != null ) return false ;
459433 } else {
460434 if (!this .name .equals (that .name )) return false ;
461435 }
462436
463437 if (this .action == null ) {
438+
464439 return that .action == null ;
465440 } else {
466441 return this .action .equals (that .action );
0 commit comments