Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace UIDefaultsWithResourceBundleCache with delegation #341

Open
vlsi opened this issue Jun 16, 2023 · 0 comments
Open

Replace UIDefaultsWithResourceBundleCache with delegation #341

vlsi opened this issue Jun 16, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@vlsi
Copy link
Contributor

vlsi commented Jun 16, 2023

Describe the bug

Currently UIDefaultsWithResourceBundleCache uses a copy of the resources, so it might go out of date with JDK.

Have you considered using delegation instead?

In other words, something like

public class DelegatingUIDefaults extends UIDefaults {
    private final UIDefaults base; // or an array

    public DelegatingUIDefaults(UIDefaults base) {
        this.base = base;
    }

    @Override
    public Object get(Object key, Locale l) {
        Object value = super.get(key, l); // try searching locally first
        if (value != null) {
            return value;
        }
        return base.get(key, l); // delegate if missing
    }

Additional context

See apache/jmeter#5715 (comment)

@vlsi vlsi added the bug Something isn't working label Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant