Issue Details (XML | Word | Printable)

Key: XALANJ-1434
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Dimitry E Voytenko
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XalanJ2

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

Created: 26/Feb/03 05:56 AM   Updated: 11/Dec/07 04:57 PM
Return to search
Component/s: XPath
Affects Version/s: 2.7
Fix Version/s: 2.7.1

Time Tracking:
Not Specified

File Attachments:
  Size
Text File lastpos.patch 2003-03-12 09:53 AM Dimitry E Voytenko 1 kB
Environment:
Operating System: All
Platform: All

Bugzilla Id: 17400
Xalan info: PatchAvailable
Reviewer: Kevin Cormier
Resolution Date: 01/Mar/07 03:40 AM


 Description  « Hide
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);

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Serge Knystautas made changes - 02/Sep/04 09:38 PM
Field Original Value New Value
issue.field.bugzillaimportkey 17400 26343
Henry Zongaro made changes - 16/Dec/04 04:03 PM
Priority Major [ 3 ]
Henry Zongaro made changes - 05/Jan/05 12:22 AM
Xalan-keywords PatchAvailable
Brian Minchau made changes - 10/Aug/05 03:40 PM
Affects Version/s Latest Development Code [ 10863 ]
Affects Version/s 2.4Dx [ 10867 ]
Brian Minchau made changes - 11/Aug/05 02:21 PM
Affects Version/s Latest Development Code [ 10863 ]
Affects Version/s 2.5 [ 10870 ]
Kevin Cormier made changes - 01/Mar/07 03:39 AM
Assignee Xalan Developers Mailing List [ xalan-dev@xml.apache.org ]
reviewer kcormier
Xalan info [PatchAvailable]
Kevin Cormier made changes - 01/Mar/07 03:40 AM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Fix Version/s The Latest Development Code [ 12312206 ]
Brian Minchau made changes - 11/Dec/07 03:24 PM
Fix Version/s The Latest Development Code [ 12312206 ]
Fix Version/s 2.7.1 [ 10863 ]
Affects Version/s 2.5 [ 10870 ]
Affects Version/s 2.7 [ 11080 ]