Skip to content

Commit 3e591a9

Browse files
chkallincolnthree
authored andcommitted
Performance: URLPatternParser got created for every call to getPatternParser()
1 parent 058c439 commit 3e591a9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎core/src/main/java/com/ocpsoft/pretty/faces/config/mapping/UrlMapping.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ public class UrlMapping
3636
private List<QueryParameter> queryParams = new ArrayList<QueryParameter>();
3737
private List<PathValidator> pathValidators = new ArrayList<PathValidator>();
3838
private boolean onPostback = true;
39-
private URLPatternParser parser;
40-
private boolean dirty = true;
39+
private URLPatternParser parser = null;
4140

4241
/**
4342
* Return whether or not this Mapping requires DynaView capabilities
@@ -54,7 +53,7 @@ public boolean isDynaView()
5453
*/
5554
public URLPatternParser getPatternParser()
5655
{
57-
if (((parser == null) || dirty) && (pattern != null))
56+
if ((parser == null) && (pattern != null))
5857
{
5958
this.parser = new URLPatternParser(pattern);
6059
}
@@ -151,7 +150,8 @@ public String getPattern()
151150
public void setPattern(final String pattern)
152151
{
153152
this.pattern = pattern;
154-
this.dirty = true;
153+
// reset the parser so it gets recreated
154+
this.parser = null;
155155
}
156156

157157
public boolean addQueryParam(final QueryParameter param)

0 commit comments

Comments
 (0)