[MAGNOLIA-3065] Error updating a binary nodedata Created: 09/Feb/10  Updated: 23/Jan/13  Resolved: 11/Feb/10

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 4.3
Fix Version/s: 4.3

Type: Bug Priority: Critical
Reporter: Diego Schivo Assignee: Philipp Bärfuss
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File missing-else.patch    
Template:
Patch included:
Yes
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   

The problem occurs when trying to save a dialog with a previously uploaded file (without changing that file):

javax.jcr.nodetype.ConstraintViolationException: /samples/sampleflv/image[2]: mandatory property {http://www.jcp.org/jcr/1.0}data does not exist
	at org.apache.jackrabbit.core.ItemImpl.validateTransientItems(ItemImpl.java:462)
	at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1066)
	at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:915)
	at info.magnolia.cms.core.DefaultHierarchyManager.save(DefaultHierarchyManager.java:513)
	at info.magnolia.module.admininterface.SaveHandlerImpl.save(SaveHandlerImpl.java:250)
	at info.magnolia.module.admininterface.DialogMVCHandler.onSave(DialogMVCHandler.java:312)
	at info.magnolia.module.admininterface.DialogMVCHandler.save(DialogMVCHandler.java:214)

I think the cause of the error is that method BinaryNodeData.getBinaryNode(boolean createIfNotExisting) creates a new binary-node even if there is already one, thus duplicating it (image[2]), and leaving the duplicate without any binary data (data does not exist), because no file was uploaded in the dialog.



 Comments   
Comment by Magnolia International [ 10/Feb/10 ]

Seems like an oversight indeed! Well spotted; feel free to apply the patch

Makes me wonder if/how we handle/support same-name-siblings now, though. Philipp ?

Comment by Philipp Bärfuss [ 11/Feb/10 ]

Thanks allot for the patch

Generated at Mon Feb 12 03:42:50 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.