Bug #5696
closed
Created LetClause does not have location set to it
Applies to branch:
11, trunk
Fix Committed on Branch:
11, trunk
Fixed in Maintenance Release:
Description
Using Saxon 11.
In the method "net.sf.saxon.query.XQueryParser.parseGroupByClause(FLWORExpression, List)" a LetClause is created:
LetClause letClause = new LetClause();
maybe a location should also be set on it:
setLocation(letClause, t.currentTokenStartOffset);
otherwise the localization for such elements will be off.
Also the method "net.sf.saxon.expr.Locatable.getLocation()" has no Javadoc, does it allow the possibility to return a null item?
Yes, it would be better to set the location explicitly (we can usually get away with not doing, because if we don't set the location explicitly, it's usually picked up from other nearby expressions in the tree; but it's safer not to rely on that).
The convention should be that methods like getLocation()
return Loc.NONE
rather than null if no information is available. I can't guarantee that that's always going to be the case, though. It would definitely be prudent to check for the result being null.
Right, thanks. On our side in the debugger code we usually assume the getLocation() method never returns null and usually this is the case, except in this particular situation.
- Category set to Diagnostics
- Status changed from New to Resolved
- Assignee set to Michael Kay
- Applies to branch 11, trunk added
- Fix Committed on Branch 11, trunk added
- Platforms .NET, Java added
In fact, while Expression.getLocation()
searches around the tree for a location on an ancestor node, the same is not true for Clause.getLocation()
- if it hasn't been set, it returns null.
- % Done changed from 0 to 100
- Fixed in Maintenance Release 12.0 added
Bug issue fix applied in the Saxon 12.0 Major Release.
Leaving this bug marked as Resolved until fix applied
- Fixed in Maintenance Release 11.5 added
Bug applied in the Saxon 11.5 Maintenance release.
- Status changed from Resolved to Closed
Please register to edit this issue
Also available in: Atom
PDF