[MAGNOLIA-7226] Consistent Return Statements from Certain NodeUtil Methods Created: 20/Dec/17 Updated: 10/Mar/21 |
|
| Status: | Open |
| Project: | Magnolia |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Julian Nodarse | Assignee: | Unassigned |
| Resolution: | Unresolved | 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)
|
||||||||||||
| Description |
|
The catch block for getNodeIdentifierIfPossible(Node content) and getNodePathIfPossible(Node node) both return “<not available>” . To keep things consistent, it is preferred to have these two catch blocks be similar to that of the getPathIfPossible(Node node) method, where it returns the empty string or null instead of “<not available>". See below for the code: public static String getNodeIdentifierIfPossible(Node content) { try { return content.getIdentifier(); } catch (RepositoryException e) { return "<not available>"; } } public static String getNodePathIfPossible(Node node) { try { return node.getPath(); } catch (RepositoryException e) { return "<not available>"; } } public static String getPathIfPossible(Node node) { try { return node.getPath(); } catch (RepositoryException e) { log.error("Failed to get handle: {}", e.getMessage(), e); return ""; } } |