Skip to content

Commit

Permalink
Proper exception in PreferencesService#setDefaultLookupOrder() #464
Browse files Browse the repository at this point in the history
PreferencesService#setDefaultLookupOrder(String, String, String[]) has
recently been changed to now throwing a NullPointerException instead of
an IllegalArgumentException in case of any of its order arguments being
null. This is incompatible with the API documentation in
IPreferencesService.
This change restores the existing behavior of throwing an
IllegalArgumentException in the mentioned case.

Fixes #464
  • Loading branch information
HeikoKlare authored and iloveeclipse committed Jan 4, 2024
1 parent d52b39e commit de625e7
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,9 @@ public void setDefaultLookupOrder(String qualifier, String key, String[] order)
if (order == null) {
DEFAULTS_REGISTRY.remove(registryKey);
} else {
Arrays.asList(order).forEach(Objects::requireNonNull);
if (Arrays.stream(order).anyMatch(Objects::isNull)) {
throw new IllegalArgumentException();
}
DEFAULTS_REGISTRY.put(registryKey, order);
}
}
Expand Down

0 comments on commit de625e7

Please sign in to comment.