@@ -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 *
@@ -94,7 +76,6 @@ public void read(Reader policy) throws ParsingException, IOException {
9476 while (nextToken != StreamTokenizer .TT_EOF ) {
9577 if (peekTokenOnMatch ("grant" )) {
9678 ge = parseGrantEntry ();
97- // could be null if we couldn't expand a property
9879 if (ge != null ) add (ge );
9980 } else {
10081 // error?
@@ -226,7 +207,7 @@ private GrantEntry parseGrantEntry() throws ParsingException, IOException {
226207 try {
227208 PermissionEntry pe = parsePermissionEntry ();
228209 e .add (pe );
229- } catch (PropertyExpander . ExpandException peee ) {
210+ } catch (ParsingException parseException ) {
230211 skipEntry (); // BugId 4219343
231212 }
232213 consumeTokenOnMatch (";" );
@@ -236,12 +217,8 @@ private GrantEntry parseGrantEntry() throws ParsingException, IOException {
236217 }
237218 consumeTokenOnMatch ("}" );
238219
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 ;
220+ if (e .codeBase != null ) {
221+ e .codeBase = e .codeBase .replace (File .separatorChar , '/' );
245222 }
246223
247224 return (ignoreEntry ) ? null : e ;
@@ -250,7 +227,7 @@ private GrantEntry parseGrantEntry() throws ParsingException, IOException {
250227 /**
251228 * parse a Permission entry
252229 */
253- private PermissionEntry parsePermissionEntry () throws ParsingException , IOException , PropertyExpander . ExpandException {
230+ private PermissionEntry parsePermissionEntry () throws ParsingException , IOException {
254231 PermissionEntry e = new PermissionEntry ();
255232
256233 // Permission
@@ -259,7 +236,7 @@ private PermissionEntry parsePermissionEntry() throws ParsingException, IOExcept
259236
260237 if (peekTokenOnMatch ("\" " )) {
261238 // Permission name
262- e .name = expand ( consumeTokenOnMatch ("quoted string" ) );
239+ e .name = consumeTokenOnMatch ("quoted string" );
263240 }
264241
265242 if (!peekTokenOnMatch ("," )) {
@@ -268,7 +245,7 @@ private PermissionEntry parsePermissionEntry() throws ParsingException, IOExcept
268245 consumeTokenOnMatch ("," );
269246
270247 if (peekTokenOnMatch ("\" " )) {
271- e .action = expand ( consumeTokenOnMatch ("quoted string" ) );
248+ e .action = consumeTokenOnMatch ("quoted string" );
272249 if (!peekTokenOnMatch ("," )) {
273250 return e ;
274251 }
0 commit comments