<Beans Dev> [9] Review Request: 8131754 AquaTreeUI.getCollapsedIcon() issue reported in java beans tests with a modular build

Sergey Malenkov malenkov at gmail.com
Thu Nov 19 20:07:37 UTC 2015

The fix looks OK to me, because nobody expects that UI is a property
to store in XML.

On Thu, Nov 19, 2015 at 11:34 AM, Alexander Scherbatiy
<alexandr.scherbatiy at oracle.com> wrote:
>   The fix looks good to me.
>   Thanks,
>   Alexandr.
> On 11/9/2015 9:19 PM, Sergey Bylokhov wrote:
>> Hello.
>> Please review the "small" fix for jdk9.
>> Description of the problem:
>>     When the XMLEncoder writes the object to the stream it does not save
>> the whole object as is(like the usual serialization). But it creates the
>> object of the same class with default parameters and then saves only the
>> difference between the two objects. Encoder checks recursively for
>> difference the public fields and public properties(setters+getters) on
>> current object and so on. Only transient fields and @Transient properties
>> are skipped by encoder.
>>     The tests from the bug causes an exception when running on the OSX,
>> because it serialize the platform-specific data (part of Aqua L&F). This
>> occurs because XMLEncoder tries to save the ui property of JComponent.
>> Scheme of objects:
>> JComponent-A (non-default component orientation)
>>    UI-a
>> JComponent-B (default component orientation)
>>    UI-b
>>     Note that components A and B have different orientation, this
>> indirectly changes some properties of UI-a, these changes are not important
>> because they can be(and will be) restored from the component itself, but
>> XMLEncoder treats ui as sensible fields and tries to save them to the
>> stream.
>>     As a fix I suggest to mark getUI() method as @Transient, this will
>> allow the encoder to skip the changes in UI property. Note that the ui field
>> in JComponent is transient already, but it affects the usual serialization
>> only.
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8131754
>> Webrev can be found at: http://cr.openjdk.java.net/~serb/8131754/webrev.00

Best regards,
Sergey A. Malenkov

More information about the beans-dev mailing list