This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 133605 - AttributesUtilities .Immutable and .Composite don't respect the ResolveAttribute
Summary: AttributesUtilities .Immutable and .Composite don't respect the ResolveAttribute
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Settings (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@editor
URL:
Keywords: API
Depends on:
Blocks:
 
Reported: 2008-04-22 09:49 UTC by emi
Modified: 2008-04-25 12:38 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Patch Immutable / Composite to handle the resolver properly. (1.12 KB, patch)
2008-04-22 09:51 UTC, emi
Details | Diff
Immutable / Composite new patch (allows null attribute values in delegates) (1.28 KB, patch)
2008-04-22 14:00 UTC, emi
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description emi 2008-04-22 09:49:52 UTC
Both AttributesUtilities.Composite and AttributesUtilities.Immutable assume they will not receive AttributeSet-s with
the AttributeSet.ResolveAttribute attribute set.

Thus Immutable would need to call setResolveParent().

Composite.getAttribute() can't use delegate.isDefined() as isDefined explicitly doesn't go up the resolver hierarchy.

A simple testcase to show the bug would send empty delegates that only have resolvers. The Composite will always return
null attributes as delegate.isDefined() always returns false.
Comment 1 emi 2008-04-22 09:51:27 UTC
Created attachment 60532 [details]
Patch Immutable / Composite to handle the resolver properly.
Comment 2 Vitezslav Stejskal 2008-04-22 11:25:49 UTC
Thanks for the patch. May I ask for a usecase where this is needed? Btw the patch for Composite.getAttribute() changes
semantics for attributes with the 'null' value. Which effectively means that an attribute from one delegate can't be
masked out in a higher-level delegate by setting the attribute's value to null.
Comment 3 emi 2008-04-22 13:42:34 UTC
I have a custom FontColorSettings implementation (another editor storage impl) where I use ResolveAttribute.

I guess the default storage module doesn't use ResolveAttribute and that's why the bug never showed up.

Didn't notice null attributes but I guess you might be right, in this case we need to go up the getResolveParent() hierarchy and call isDefined(). I'll send you 
another patch.
Comment 4 emi 2008-04-22 14:00:57 UTC
Created attachment 60551 [details]
Immutable / Composite new patch (allows null attribute values in delegates)
Comment 5 Vitezslav Stejskal 2008-04-23 09:43:31 UTC
> I guess the default storage module doesn't use ResolveAttribute
No, it does not.

Thanks for the updated patch. I'll apply it and if all works (tests pass) I'll push the change to the main.
Comment 6 Vitezslav Stejskal 2008-04-23 11:53:39 UTC
http://hg.netbeans.org/main/rev/5eb047464b65