Skip to content

Commit

Permalink
Error if the preferences are not of expected type
Browse files Browse the repository at this point in the history
  • Loading branch information
laeubi committed May 11, 2022
1 parent 2f4e5f0 commit 966a3e1
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.lang.management.ManagementFactory;
import java.net.URI;
import java.net.URISyntaxException;
import java.text.MessageFormat;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicLong;
Expand Down Expand Up @@ -1861,7 +1862,7 @@ protected void initializeMoveDeleteHook() {
* Add the project scope to the preference service's default look-up order so
* people get it for free
*/
private void initializePreferenceLookupOrder() {
private void initializePreferenceLookupOrder() throws CoreException {
PreferencesService service = PreferencesService.getDefault();
String[] original = service.getDefaultDefaultLookupOrder();
List<String> newOrder = new ArrayList<>();
Expand All @@ -1873,6 +1874,10 @@ private void initializePreferenceLookupOrder() {
if (node instanceof ProjectPreferences) {
ProjectPreferences projectPreferences = (ProjectPreferences) node;
projectPreferences.setWorkspace(this);
} else {
throw new CoreException(Status.error(MessageFormat.format(
"Internal error while open workspace, the scope {0} should always result in a ProjectPreferences node", //$NON-NLS-1$
ProjectScope.SCOPE)));
}
}

Expand Down

0 comments on commit 966a3e1

Please sign in to comment.