You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2015/11/24 21:31:08 UTC

svn commit: r1716246 - /commons/proper/jxpath/trunk/src/main/java/org/apache/commons/jxpath/ri/Parser.java

Author: britter
Date: Tue Nov 24 20:31:08 2015
New Revision: 1716246

URL: http://svn.apache.org/viewvc?rev=1716246&view=rev
Log:
Field can be final

Modified:
    commons/proper/jxpath/trunk/src/main/java/org/apache/commons/jxpath/ri/Parser.java

Modified: commons/proper/jxpath/trunk/src/main/java/org/apache/commons/jxpath/ri/Parser.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/main/java/org/apache/commons/jxpath/ri/Parser.java?rev=1716246&r1=1716245&r2=1716246&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/main/java/org/apache/commons/jxpath/ri/Parser.java (original)
+++ commons/proper/jxpath/trunk/src/main/java/org/apache/commons/jxpath/ri/Parser.java Tue Nov 24 20:31:08 2015
@@ -31,7 +31,7 @@ import org.apache.commons.jxpath.ri.pars
  */
 public class Parser {
 
-    private static XPathParser parser = new XPathParser(new StringReader(""));
+    private static final XPathParser PARSER = new XPathParser(new StringReader(""));
 
     /**
      * Parses the XPath expression. Throws a JXPathException in case
@@ -43,12 +43,12 @@ public class Parser {
     public static Object parseExpression(
         String expression,
         Compiler compiler) {
-        synchronized (parser) {
-            parser.setCompiler(compiler);
+        synchronized (PARSER) {
+            PARSER.setCompiler(compiler);
             Object expr;
             try {
-                parser.ReInit(new StringReader(expression));
-                expr = parser.parseExpression();
+                PARSER.ReInit(new StringReader(expression));
+                expr = PARSER.parseExpression();
             }
             catch (TokenMgrError e) {
                 throw new JXPathInvalidSyntaxException(