[MGNLRSSAGG-91] Using a path with a dash ("-") or a feed name starting with a digit in a stkSingleFeed paragraph causes an exception in FeedListModel Created: 01/Aug/13 Updated: 06/Dec/13 Resolved: 22/Aug/13 |
|
| Status: | Closed |
| Project: | Magnolia RSS Aggregator Module |
| Component/s: | None |
| Affects Version/s: | 1.2.4 |
| Fix Version/s: | 1.4.3, 2.0.2 |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Nils Breunese | Assignee: | Roman Kovařík |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Template: |
|
| Acceptance criteria: |
Empty
|
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
| Date of First Response: |
| Description |
|
I created an RSS Aggregator under AdminCentral > Data > RSS Aggregators and called it '3FM Lowlands'. This created data:/rssaggregator/3FM-Lowlands. When selecting this path in an instance of stkSingleFeed the FeedListModel class throws an InvalidQueryException in the getFeeds() method, saying: javax.jcr.query.InvalidQueryException: Encountered "-" at line 1, column 38. Was expecting one of: <IntegerLiteral> ... <DecimalLiteral> ... <DoubleLiteral> ... <StringLiteral> ... "<?" ... "<?" ... <AxisChild> ... <AxisDescendant> ... <AxisParent> ... <AxisAttribute> ... <AxisSelf> ... <AxisDescendantOrSelf> ... <AxisAncestor> ... <AxisFollowingSibling> ... <AxisPrecedingSibling> ... <AxisFollowing> ... <AxisPreceding> ... <AxisAncestorOrSelf> ... "$" ... <ElementType> ... <AttributeType> ... <SchemaElementType> ... <SchemaAttributeType> ... <OrderedOpen> ... <UnorderedOpen> ... <ElementQNameLbrace> ... <AttributeQNameLbrace> ... <PINCNameLbrace> ... <PILbrace> ... <CommentLbrace> ... <ElementLbrace> ... <AttributeLbrace> ... <TextLbrace> ... "*" ... <NCNameColonStar> ... <StarColonNCName> ... "(" ... "@" ... <DocumentLpar> ... <DocumentLparForKindTest> ... <DocumentLbrace> ... <NodeLpar> ... <CommentLpar> ... <TextLpar> ... <ProcessingInstructionLpar> ... <ElementTypeForKindTest> ... <ElementTypeForDocumentTest> ... <AttributeTypeForKindTest> ... <SchemaElementTypeForKindTest> ... <SchemaElementTypeForDocumentTest> ... <SchemaAttributeTypeForKindTest> ... <ProcessingInstructionLparForKindTest> ... <TextLparForKindTest> ... <CommentLparForKindTest> ... <NodeLparForKindTest> ... "." ... ".." ... <QNameLpar> ... "<" ... "<" ... "<!--" ... "<!--" ... <QName> ... for statement: for $v in /jcr:root/rssaggregator/3FM-Lowlands/data/element(*, dataItemNode) order by @jcr:name return $v The paragraph doesn't render correctly after that too:
2013-08-01 13:40:45,279 ERROR freemarker.runtime : Error on line 26, column 1 in templating-kit/paragraphs/teasers/stkTeaserSingleFeed.ftl
model.feeds is undefined.
It cannot be assigned to feedList
Error on line 26, column 1 in templating-kit/paragraphs/teasers/stkTeaserSingleFeed.ftl
model.feeds is undefined.
It cannot be assigned to feedList
The problematic instruction:
----------
==> assignment: feedList=model.feeds [on line 26, column 1 in templating-kit/paragraphs/teasers/stkTeaserSingleFeed.ftl]
----------
Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Error on line 26, column 1 in templating-kit/paragraphs/teasers/stkTeaserSingleFeed.ftl
model.feeds is undefined.
It cannot be assigned to feedList
|
| Comments |
| Comment by Nils Breunese [ 01/Aug/13 ] |
|
It seems that the fact that '3FM Lowlands' starts with a digit is also causing problems. Taking out both the space and the digit seems to be a workaround, but I feel the model class code should handle this. |
| Comment by Nils Breunese [ 02/Aug/13 ] |
|
I see fix version is now set for 1.4.3. Any chance of a 1.2.5 release that supports Magnolia 4.4? (We're working on migrating our codebase to 4.5, but that is going to take quite a while.) |
| Comment by Nils Breunese [ 08/Aug/13 ] |
|
I guess the path elements needs to be encoded using the ISO9075 class? |
| Comment by Jaroslav Simak [ 08/Aug/13 ] |
|
Hi Nils, Reason is that nodes cannot start with digits when using xpath. It also seems that same rule applies for dash (-). So indeed one solution is to escape them with the class you mentioned or rewrite query to use SQL (or SQL2). Regards. |
| Comment by Jan Haderka [ 16/Aug/13 ] |
|
Old query would return only nodes of DataConsts.MODULE_DATA_CONTENT_NODE_TYPE type. New one returns anything living under given path. This needs to be fixed. |
| Comment by Jan Haderka [ 22/Aug/13 ] |
|
AbstractFeedModel.runQuerry() should be AbstractFeedModel.runQuery() |