[MGNLUI-4119] ReadOnlyException upon handling empty value of a MagnoliaRichTextField Created: 12/Jan/17  Updated: 18/Sep/19  Resolved: 18/Apr/19

Status: Closed
Project: Magnolia UI
Component/s: dialogs
Affects Version/s: 5.4
Fix Version/s: 5.5.14, 5.6.10, 5.7.3, 6.1

Type: Bug Priority: Major
Reporter: Michael Kaiser Assignee: Adam Siska
Resolution: Fixed Votes: 2
Labels: None
Remaining Estimate: 0d
Time Spent: 6h 14m
Original Estimate: Not Specified

Attachments: PNG File image-2019-03-26-08-35-36-788.png    
Issue Links:
Cloners
causality
relation
is related to MGNLUI-4322 Show version of empty RichTextField v... Closed
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:
Visible to:
Jennifer Brehm
Epic Link: Support
Sprint: Foundation 7, Foundation 8, Foundation 9
Story Points: 3

 Description   

In a custom content app, we are using MagnoliaRichTextField in the detail sub-app. When a user tries to open a previous version of a record and the text field was empty in this version of the record, an exception is thrown. From what I gather, the conflict is between these two statements:

https://git.magnolia-cms.com/projects/PLATFORM/repos/ui/browse/magnolia-ui-vaadin-common-widgets/src/main/java/info/magnolia/ui/vaadin/richtext/MagnoliaRichTextField.java#84

and the following line in com.vaadin.ui.AbstractField#setValue(T, boolean):

 if (!SharedUtil.equals(newFieldValue, getInternalValue())) {

            // Read only fields can not be changed
            if (isReadOnly()) {
                throw new Property.ReadOnlyException();
            }
...

The problem seems to be that the value is supposed to be set to null but the field is already initialized with "". Since these values are not the same, the ReadOnlyException is triggered.



 Comments   
Comment by Samuel Kohler [ 23/Nov/18 ]

Hi everyone
I have this bug in my magnolia 5.7.1 project. Is there a workaround or do you know when this issue will be fixed?

Regards,
Sam

Comment by Jonathan Ayala [ 21/Dec/18 ]

This is happening when RichTextField is marked as readOnly. During field creation, the following lines are executed:

info.magnolia.ui.vaadin.richtext.MagnoliaRichTextField.changeVariables(Object, Map<String, Object>)
...
if(isEmpty()) {
            this.setValue(null, true);
        }
...

readOnly property should be checked before setting the value.

Comment by Adam Siska [ 26/Mar/19 ]

Found other glitches related to Show versions dialog:

First, text within combo box has transparent color:

Second, when any demo tour with some publish history is chosen, when click on any version in Show versions dialog, exception is thrown and opened subapp didn't get focus:
ERROR info.magnolia.event.SimpleEventBus : Exception caught when dispatching info.magnolia.ui.api.location.LocationChangedEvent with info.magnolia.ui.framework.app.AppControllerImpl eventHandler.
com.vaadin.v7.data.Buffered$SourceException: null
Caused by: com.vaadin.v7.data.Property$ReadOnlyException
at com.vaadin.v7.ui.AbstractField.setValue(AbstractField.java:467) ~[vaadin-compatibility-server-8.5.2.jar:8.5.2]
at com.vaadin.v7.ui.AbstractField.setValue(AbstractField.java:442) ~[vaadin-compatibility-server-8.5.2.jar:8.5.2]

EDIT: Second issue is caused by selections in Tour types and/or Destinations.

Generated at Mon Feb 12 09:13:28 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.