commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmi...@apache.org
Subject cvs commit: jakarta-commons/jxpath/src/test/org/apache/commons/jxpath JXPathTestCase.java
Date Tue, 18 Jun 2002 00:01:16 GMT
dmitri      2002/06/17 17:01:16

  Modified:    jxpath/src/java/org/apache/commons/jxpath/ri/model/beans
                        PropertyOwnerPointer.java
               jxpath/src/java/org/apache/commons/jxpath/ri/axes
                        PredicateContext.java
               jxpath/src/java/org/apache/commons/jxpath/ri/model
                        NodePointer.java
               jxpath/src/test/org/apache/commons/jxpath
                        JXPathTestCase.java
  Log:
  Bug fix: #9912
  
  Revision  Changes    Path
  1.5       +4 -12     jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java
  
  Index: PropertyOwnerPointer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PropertyOwnerPointer.java	8 May 2002 23:05:05 -0000	1.4
  +++ PropertyOwnerPointer.java	18 Jun 2002 00:01:15 -0000	1.5
  @@ -155,14 +155,6 @@
   
       public abstract PropertyPointer getPropertyPointer();
   
  -    /**
  -     * If has an index, returns a pointer to the collection element,
  -     * otherwise returns the pointer itself.
  -     */
  -    public NodePointer getValuePointer() {
  -        return NodePointer.newChildNodePointer(this, getName(), getNodeValue());
  -    }
  -
       public NodePointer createChild(JXPathContext context, QName name, int index, Object
value){
           PropertyPointer prop = getPropertyPointer();
           prop.setPropertyName(name.getName());
  
  
  
  1.11      +10 -5     jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/axes/PredicateContext.java
  
  Index: PredicateContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/axes/PredicateContext.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PredicateContext.java	30 May 2002 01:57:23 -0000	1.10
  +++ PredicateContext.java	18 Jun 2002 00:01:15 -0000	1.11
  @@ -137,10 +137,15 @@
           }
   
           NodePointer parent = parentContext.getCurrentNodePointer();
  +        if (parent == null){
  +            return false;
  +        }
  +        parent = parent.getValuePointer();
           if (!(parent instanceof PropertyOwnerPointer)){
               return false;
           }
  -        dynamicPropertyPointer = ((PropertyOwnerPointer)parent).getPropertyPointer();
  +        dynamicPropertyPointer =
  +            ((PropertyOwnerPointer)parent).getPropertyPointer();
           return true;
       }
   
  
  
  
  1.7       +9 -7      jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/NodePointer.java
  
  Index: NodePointer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/NodePointer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- NodePointer.java	8 Jun 2002 22:47:24 -0000	1.6
  +++ NodePointer.java	18 Jun 2002 00:01:15 -0000	1.7
  @@ -407,9 +407,11 @@
        * that match the given NodeTest, starting with the specified one.
        */
       public NodeIterator childIterator(
  -        NodeTest test,
  -        boolean reverse,
  -        NodePointer startWith) {
  +                    NodeTest test, boolean reverse, NodePointer startWith) {
  +        NodePointer valuePointer = getValuePointer();
  +        if (valuePointer != null && valuePointer != this){
  +            return valuePointer.childIterator(test, reverse, startWith);
  +        }
           return null;
       }
   
  
  
  
  1.24      +18 -7     jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/JXPathTestCase.java
  
  Index: JXPathTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/JXPathTestCase.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- JXPathTestCase.java	9 Jun 2002 01:58:41 -0000	1.23
  +++ JXPathTestCase.java	18 Jun 2002 00:01:16 -0000	1.24
  @@ -286,7 +286,10 @@
           Map tm = new HashMap();
           tm.put("bar", "zz");
           bean.getMap().put("foo", new Map[]{tm, tm});
  +        bean.getMap().put("biz", tm);
  +
           testGetValue(context, "map/foo[2]/bar/../bar", "zz");
  +        testGetValue(context, "map[@name='biz'][@name='bar']", "zz");
   
           boolean exception = false;
           try {
  @@ -921,9 +924,9 @@
       }
   
       public void testParserReferenceImpl() throws Exception {
  -        if (!enabled){
  -            return;
  -        }
  +//        if (!enabled){
  +//            return;
  +//        }
           System.setProperty(JXPathContextFactory.FACTORY_NAME_PROPERTY,
                   "org.apache.commons.jxpath.ri.JXPathContextFactoryReferenceImpl");
           testParser(JXPathContextFactory.newInstance().newContext(null, bean), false);
  @@ -1201,6 +1204,14 @@
           test("map/Key1", "Value 1"),
           testPath("map/Key1", "/map[@name='Key1']"),
           testPath("map[@name = 'Key"'"'1']", "/map[@name='Key"'"'1']"),
  +        test("map/Key2/name", "Name 6"),
  +        testPath("map/Key2/name", "/map[@name='Key2']/name"),
  +        test("/.[@name='map']/Key2/name", "Name 6"),
  +        testPath("/.[@name='map']/Key2/name", "/map[@name='Key2']/name"),
  +        test("/map[@name='Key2'][@name='name']", "Name 6"),
  +        testPath("/map[@name='Key2'][@name='name']", "/map[@name='Key2']/name"),
  +        test("/.[@name='map'][@name='Key2'][@name='name']", "Name 6"),
  +        testPath("/.[@name='map'][@name='Key2'][@name='name']", "/map[@name='Key2']/name"),
   
           // Standard functions
           test("string(2)", "2"),
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message