[MGNLMIGRATION-225] Extends creation now leaves empty nodes behind Created: 12/Feb/13  Updated: 08/Mar/13  Resolved: 08/Mar/13

Status: Closed
Project: Migration 4.4 to 4.5 (closed)
Component/s: Migration Task
Affects Version/s: 1.2.1
Fix Version/s: 1.2.1

Type: Bug Priority: Blocker
Reporter: Natascha Desmarais Assignee: Robert Šiška
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File extends_issue_mgnlmigration121.png    
Issue Links:
dependency
Template:
Acceptance criteria:
Empty
Date of First Response:

 Description   

The task that does the extends transformation and deletes redundant nodes now leaves empty nodes behind. Either it doesn't clean them up as previously or maybe it has something to do with recently fixed path issues regarding extends (if so, please link in this issue).

The groovy/1.1.x version of this did a clean up of empty nodes at the end of an extends transformation.



 Comments   
Comment by Jan Haderka [ 15/Feb/13 ]

+                boolean hasChildren = NodeUtil.asList(NodeUtil.getNodes(tmpNode, NodeUtil.EXCLUDE_META_DATA_FILTER)).size()<1?false:true;
+                boolean hasProperties = new JCRMgnlPropertiesFilteringNodeWrapper(tmpNode).getProperties().getSize()<1?false:true;

Were you actually trying to obfuscate the code instead of fix the issue? Why are you using ternary statements to express simple boolean? Was it not boolean enough the first time?

And since this is a regression, there should be a junit test for this change.

Comment by Samuel Schmitt [ 15/Feb/13 ]

I dont understand why I obfuscate the code... and the issue is fixed.
And sorry i didn't see in our coding convention that ternary is forbidden

Comment by Jan Haderka [ 15/Feb/13 ]

You gotta be kidding me, right? You use the boolean statement to set the boolean value of boolean property. The result would be exactly the same without the ternary if you just negated the condition. And it would be easier to read. So, no ternaries are not forbidden, but in this case totally unnecessary. I know you don't like to think about it, but every line of code we write we have to also maintain, which means that sooner or later someone else would have to read it again and try to understand the intention.

Comment by Robert Šiška [ 08/Mar/13 ]

test added

Generated at Mon Feb 12 10:18:21 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.