@@ -27,19 +27,6 @@ public class PolicyParser {
27
27
28
28
private StreamTokenizer streamTokenizer ;
29
29
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
- }
43
30
44
31
/**
45
32
* Creates a PolicyParser object.
@@ -49,22 +36,17 @@ public PolicyParser() {
49
36
grantEntries = new Vector <>();
50
37
}
51
38
52
- public PolicyParser (boolean expandProp ) {
53
- this ();
54
- this .expandProp = expandProp ;
55
- }
56
-
57
39
/**
58
40
* Reads a policy configuration into the Policy object using a
59
41
* Reader object.
60
42
*
61
43
* @param policy the policy Reader object.
62
44
*
63
45
* @exception ParsingException if the policy configuration contains
64
- * a syntax error.
46
+ * a syntax error.
65
47
*
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.
68
50
*/
69
51
70
52
public void read (Reader policy ) throws ParsingException , IOException {
@@ -74,17 +56,17 @@ public void read(Reader policy) throws ParsingException, IOException {
74
56
75
57
/*
76
58
* 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
81
63
*/
82
64
streamTokenizer = Tokenizer .configureTokenizer (policy );
83
65
84
66
/*
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
88
70
* the information for an entry, go ahead and try to
89
71
* add it to the policy vector.
90
72
*
@@ -223,34 +205,25 @@ private GrantEntry parseGrantEntry() throws ParsingException, IOException {
223
205
224
206
while (!peekTokenOnMatch ("}" )) {
225
207
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
+
232
212
consumeTokenOnMatch (";" );
233
213
} else {
234
214
throw new ParsingException (streamTokenizer .lineno (), "Expected permission entry" );
235
215
}
236
216
}
237
217
consumeTokenOnMatch ("}" );
238
218
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 , '/' );
245
221
}
246
222
247
223
return (ignoreEntry ) ? null : e ;
248
224
}
249
225
250
- /**
251
- * parse a Permission entry
252
- */
253
- private PermissionEntry parsePermissionEntry () throws ParsingException , IOException , PropertyExpander .ExpandException {
226
+ private PermissionEntry parsePermissionEntry () throws ParsingException , IOException {
254
227
PermissionEntry e = new PermissionEntry ();
255
228
256
229
// Permission
@@ -259,7 +232,7 @@ private PermissionEntry parsePermissionEntry() throws ParsingException, IOExcept
259
232
260
233
if (peekTokenOnMatch ("\" " )) {
261
234
// Permission name
262
- e .name = expand ( consumeTokenOnMatch ("quoted string" ) );
235
+ e .name = consumeTokenOnMatch ("quoted string" );
263
236
}
264
237
265
238
if (!peekTokenOnMatch ("," )) {
@@ -268,7 +241,7 @@ private PermissionEntry parsePermissionEntry() throws ParsingException, IOExcept
268
241
consumeTokenOnMatch ("," );
269
242
270
243
if (peekTokenOnMatch ("\" " )) {
271
- e .action = expand ( consumeTokenOnMatch ("quoted string" ) );
244
+ e .action = consumeTokenOnMatch ("quoted string" );
272
245
if (!peekTokenOnMatch ("," )) {
273
246
return e ;
274
247
}
@@ -455,12 +428,14 @@ public boolean equals(Object obj) {
455
428
}
456
429
457
430
if (this .name == null ) {
431
+
458
432
if (that .name != null ) return false ;
459
433
} else {
460
434
if (!this .name .equals (that .name )) return false ;
461
435
}
462
436
463
437
if (this .action == null ) {
438
+
464
439
return that .action == null ;
465
440
} else {
466
441
return this .action .equals (that .action );
0 commit comments