[MGNLUI-4960] Exception when (de)selecting checkbox in Dialog Created: 09/Nov/15  Updated: 21/Jan/19

Status: Open
Project: Magnolia UI
Component/s: None
Affects Version/s: 5.3.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: geert hooning Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: dialog
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File stacktrace.txt     PNG File step1.png     PNG File step2.png     PNG File step3.png    
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

 Description   

In a Dialog I have an OptionGroup with Checkboxes. When the last checked check box is de-selected, the following Exception is Thrown:

com.vaadin.data.util.converter.Converter$ConversionException: Cannot convert class java.util.LinkedHashSet to class java.util.LinkedList

After this every checkbox checked/unchecked causes the same Exception.

Something seems to go wrong in the ListToSetTransformer. When I override the ListToSetTransformer.writeToItem(T newValue) method like this:

public void writeToItem(T newValue) {
Property<T> p = getOrCreateProperty(type, true); // !! SET checkTypes TO TRUE !!

if (p.getValue() instanceof List && newValue instanceof Set) {
newValue = (T) new LinkedList((Set) newValue);
if (((List<?>) newValue).isEmpty())

{ newValue = null; }

}
p.setValue(newValue);
}

the Exception is gone and everything seems to work correctly. Could this be the solution? Or am I missing something?

Includes are the stacktrace and screenshots of the steps taken.


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