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

Fix #15250. #15251

Merged
merged 8 commits into from
Oct 25, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove instance variable requiring access to Local implementation w…
…hile loading preferences.
  • Loading branch information
dkocher committed Oct 23, 2023
commit b8283badcd08b89815de5f9f611a2b3295980e51
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@
public class UserDefaultsPreferences extends DefaultPreferences {
private static final Logger log = LogManager.getLogger(UserDefaultsPreferences.class);

private final NSBundle bundle = new BundleApplicationResourcesFinder().bundle();

private final LRUCache<String, String> cache = LRUCache.usingLoader(this::loadProperty, 1000);

private static final String MISSING_PROPERTY = String.valueOf(StringUtils.INDEX_NOT_FOUND);
Expand All @@ -72,6 +70,7 @@ public String getDefault(final String property) {
// Lookup in the default map
final String value = super.getDefault(property);
if(null == value) {
final NSBundle bundle = new BundleApplicationResourcesFinder().bundle();
// Missing in default. Lookup in Info.plist
NSObject plist = bundle.infoDictionary().objectForKey(property);
if(null == plist) {
Expand Down Expand Up @@ -170,6 +169,7 @@ protected void setDefaults() {
this.setDefault("local.user.home", SystemB.INSTANCE.getpwuid(LibC.INSTANCE.getuid()).pw_dir);
}

final NSBundle bundle = new BundleApplicationResourcesFinder().bundle();
if(null != bundle) {
if(bundle.objectForInfoDictionaryKey("CFBundleName") != null) {
this.setDefault("application.name", bundle.objectForInfoDictionaryKey("CFBundleName").toString());
Expand Down Expand Up @@ -272,6 +272,7 @@ public String locale() {

@Override
public List<String> applicationLocales() {
final NSBundle bundle = new BundleApplicationResourcesFinder().bundle();
return this.toList(bundle.localizations());
}

Expand Down