commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1564371 - in /commons/proper/jxpath/trunk/src: java/org/apache/commons/jxpath/JXPathContext.java test/org/apache/commons/jxpath/ri/JXPathContextReferenceImplTestCase.java
Date Tue, 04 Feb 2014 16:40:11 GMT
Author: ggregory
Date: Tue Feb  4 16:40:10 2014
New Revision: 1564371

URL: http://svn.apache.org/r1564371
Log:
[JXPATH-166] JXPathContextReferenceImpl.addNodePointerFactory not working anymore. Add test
case. revert -N C:/vcs/svn/apache/commons/trunks-proper/jxpath/src/java/org/apache/commons/jxpath/JXPathContext.java
    Reverted C:/vcs/svn/apache/commons/trunks-proper/jxpath/src/java/org/apache/commons/jxpath/JXPathContext.java
diff --summarize --depth=infinity --ignoreAncestry -r 1523175:1523033 https://svn.apache.org/repos/asf/commons/proper/jxpath/trunk
merge --depth=infinity -r1523175:1523174 https://svn.apache.org/repos/asf/commons/proper/jxpath/trunk
C:/vcs/svn/apache/commons/trunks-proper/jxpath
    --- Reverse-merging r1523175 through r1523174 into C:/vcs/svn/apache/commons/trunks-proper/jxpath
    U   C:/vcs/svn/apache/commons/trunks-proper/jxpath/src/java/org/apache/commons/jxpath/JXPathContext.java
    Merge info recorded for C:/vcs/svn/apache/commons/trunks-proper/jxpath
     U  C:/vcs/svn/apache/commons/trunks-proper/jxpath
    Merge complete.
    ===== File Statistics: =====
    Updated: 1
    ==== Property Statistics: =====
    Updated: 2

Added:
    commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/JXPathContextReferenceImplTestCase.java
  (with props)
Modified:
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContext.java

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContext.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContext.java?rev=1564371&r1=1564370&r2=1564371&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContext.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContext.java Tue
Feb  4 16:40:10 2014
@@ -380,17 +380,8 @@ import org.apache.commons.jxpath.util.Ke
  * @version $Revision$ $Date$
  */
 public abstract class JXPathContext {
-	
-	static {
-		// Initialize in this order:
-		// 1) contextFactory
-	    contextFactory = JXPathContextFactory.newInstance();
-		// 2) compilationContext
-	    compilationContext = JXPathContext.newContext(null);		
-	}
-	
-    private static final JXPathContextFactory contextFactory;
-    private static final JXPathContext compilationContext;
+    private static volatile JXPathContextFactory contextFactory;
+    private static volatile JXPathContext compilationContext;
 
     private static final PackageFunctions GENERIC_FUNCTIONS =
         new PackageFunctions("", null);
@@ -444,6 +435,9 @@ public abstract class JXPathContext {
      * @return JXPathContextFactory
      */
     private static JXPathContextFactory getContextFactory () {
+        if (contextFactory == null) {
+            contextFactory = JXPathContextFactory.newInstance();
+        }
         return contextFactory;
     }
 
@@ -652,6 +646,9 @@ public abstract class JXPathContext {
      * @return CompiledExpression
      */
     public static CompiledExpression compile(String xpath) {
+        if (compilationContext == null) {
+            compilationContext = JXPathContext.newContext(null);
+        }
         return compilationContext.compilePath(xpath);
     }
 

Added: commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/JXPathContextReferenceImplTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/JXPathContextReferenceImplTestCase.java?rev=1564371&view=auto
==============================================================================
--- commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/JXPathContextReferenceImplTestCase.java
(added)
+++ commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/JXPathContextReferenceImplTestCase.java
Tue Feb  4 16:40:10 2014
@@ -0,0 +1,15 @@
+package org.apache.commons.jxpath.ri;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.jxpath.ri.model.container.ContainerPointerFactory;
+
+public class JXPathContextReferenceImplTestCase extends TestCase {
+
+    /**
+     * https://issues.apache.org/jira/browse/JXPATH-166
+     */
+    public void testInit() {
+        JXPathContextReferenceImpl.addNodePointerFactory(new ContainerPointerFactory());
+    }
+}

Propchange: commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/JXPathContextReferenceImplTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/JXPathContextReferenceImplTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message