XalanJ2
  1. XalanJ2
  2. XALANJ-1434

org.apache.xpath.axes.AxesWalker getLastPos: duplicate predicate testing

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.7
    • Fix Version/s: 2.7.1
    • Component/s: XPath
    • Labels:
      None
    • Environment:
      Operating System: All
      Platform: All

      Description

      In class org.apache.xpath.axes.AxesWalker method getLastPos there's a fragment
      of code:
      walker.setPredicateCount(walker.getPredicateCount() - 1);

      Thus, in expression x[last() != position()][true()] first predicate is checked
      twice.

      XML sample:
      <?xml version="1.0" encoding="UTF-8"?>
      <doc>
      <item>1</item>
      <item>2</item>
      <item>3</item>
      </doc>

      Result of
      <xsl:copy-of select="/doc/item[last() != position()][true()]"/>

      is
      <item>1</item>

      and should be
      <item>1</item>
      <item>2</item>

      XSL work-around:
      <xsl:copy-of select="(/doc/item[last() != position()])[true()]"/>

      Java code fix: replace code line in org.apache.xpath.axes.AxesWalker getLastPos:
      walker.setPredicateCount(walker.getPredicateCount() - 1);
      to
      walker.setPredicateCount(this.m_predicateIndex);

        Activity

        Dimitry E Voytenko created issue -
        Serge Knystautas made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 17400 26343
        Henry Zongaro made changes -
        Priority Major [ 3 ]
        Henry Zongaro made changes -
        Xalan-keywords PatchAvailable
        Brian Minchau made changes -
        Affects Version/s 2.4Dx [ 10867 ]
        Affects Version/s Latest Development Code [ 10863 ]
        Brian Minchau made changes -
        Affects Version/s 2.5 [ 10870 ]
        Affects Version/s Latest Development Code [ 10863 ]
        Kevin Cormier made changes -
        Xalan info [PatchAvailable]
        Assignee Xalan Developers Mailing List [ xalan-dev@xml.apache.org ]
        reviewer kcormier
        Kevin Cormier made changes -
        Resolution Fixed [ 1 ]
        Fix Version/s The Latest Development Code [ 12312206 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Brian Minchau made changes -
        Affects Version/s 2.5 [ 10870 ]
        Fix Version/s The Latest Development Code [ 12312206 ]
        Affects Version/s 2.7 [ 11080 ]
        Fix Version/s 2.7.1 [ 10863 ]
        Mark Thomas made changes -
        Workflow jira [ 36338 ] Default workflow, editable Closed status [ 12571103 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12571103 ] jira [ 12594907 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Dimitry E Voytenko
            Reviewer:
            Kevin Cormier
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development