[MAGNOLIA-3058] AbstractNodeData#getReferencedContent(..) throws PathNotFoundException Created: 03/Feb/10 Updated: 23/Jan/13 Resolved: 26/Feb/10 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | core |
| Affects Version/s: | 4.3 |
| Fix Version/s: | 4.3 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Federico Grilli | Assignee: | Jan Haderka |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| 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 |
|
While working with the demo-project I noticed that all the internal links show the message "Target page of link does not exist". 2010-02-03 12:20:25,702 ERROR info.magnolia.module.templatingkit.util.STKUtil : Can't resolve reference [/demo-project/footer/02/linkList/03/link] with uuid [f312fc16-8f66-451c-bdf0-a72913b74c2d] // is this relative path? if (!pathOrUUID.startsWith("/")) { refNode = node.getContent(pathOrUUID); } |
| Comments |
| Comment by Magnolia International [ 04/Feb/10 ] |
|
The PathNotFoundException was thrown in this case because pathOrUUID IS a uuid when we do getContent(pathOrUUID). Instead of "assuming pathOrUUID is a path, check if it exists", the fix for this should be to check earlier if pathOrUUID is a uuid or indeed a path (the pattern of UUIDs is fairly detectable, although it could still conflict if a node had the same name... - maybe another approach would be to check hm.getContentByUUID() / ItemNotFoundException first ? The PathNotFoundException should still be thrown if pathOrUUID is a path to an unexisting node. This isn't the case anymore with this fix. |
| Comment by Jan Haderka [ 05/Feb/10 ] |
|
PathNotFoundException was never thrown by this method before changes to content API. There is other code (like in STK) that doesn't expect the exception. The fix restored the original behavior of the method. |
| Comment by Jan Haderka [ 26/Feb/10 ] |
|
Changed the code to check for the UID first. Not checking the UUID format explicitly, since apparently JCR spec doesn't define the format of UUID and some implementations use different format (exo and notes for example). |