Skip to content
Permalink
Browse files
[JXPATH-166] JXPathContextReferenceImpl.addNodePointerFactory not wor…
…king 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


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/jxpath/trunk@1564371 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
garydgregory committed Feb 4, 2014
1 parent 1a3d3e3 commit dceb292201df5d107168efa0da1b960a482d6617
Showing 2 changed files with 23 additions and 11 deletions.
@@ -380,17 +380,8 @@
* @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 static JXPathContext newContext(
* @return JXPathContextFactory
*/
private static JXPathContextFactory getContextFactory () {
if (contextFactory == null) {
contextFactory = JXPathContextFactory.newInstance();
}
return contextFactory;
}

@@ -652,6 +646,9 @@ public synchronized boolean isLenient() {
* @return CompiledExpression
*/
public static CompiledExpression compile(String xpath) {
if (compilationContext == null) {
compilationContext = JXPathContext.newContext(null);
}
return compilationContext.compilePath(xpath);
}

@@ -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());
}
}

0 comments on commit dceb292

Please sign in to comment.