Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2018-08-23 20:43:34 +0000
committerJeff Johnston2018-08-23 21:26:31 +0000
commit3ae1af9e883fccc75335a2a18dbb25372858b1ec (patch)
tree576077163af3e3452b31620c69801de21b31377c
parent938e22e4e1838f706322589cb9d15352b4bcbc69 (diff)
downloadorg.eclipse.linuxtools-3ae1af9e883fccc75335a2a18dbb25372858b1ec.tar.gz
org.eclipse.linuxtools-3ae1af9e883fccc75335a2a18dbb25372858b1ec.tar.xz
org.eclipse.linuxtools-3ae1af9e883fccc75335a2a18dbb25372858b1ec.zip
Bug 538221 - NullPointerException in LinuxtoolsPathPropertyPage
- verify that class variables are initialized before referring to them in performOk(), performDefaults(), and performApply() Change-Id: If5d5b2d9ab85c3ff1b8b17d39fcc94ad4772ddc9 Reviewed-on: https://git.eclipse.org/r/127962 Tested-by: CI Bot Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/internal/tools/launch/ui/properties/LinuxtoolsPathPropertyPage.java30
1 files changed, 19 insertions, 11 deletions
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/internal/tools/launch/ui/properties/LinuxtoolsPathPropertyPage.java b/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/internal/tools/launch/ui/properties/LinuxtoolsPathPropertyPage.java
index d402d7bf28..024d6369eb 100644
--- a/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/internal/tools/launch/ui/properties/LinuxtoolsPathPropertyPage.java
+++ b/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/internal/tools/launch/ui/properties/LinuxtoolsPathPropertyPage.java
@@ -67,6 +67,7 @@ public class LinuxtoolsPathPropertyPage extends PropertyPage {
private Composite result;
private Button systemEnvButton, customButton;
private boolean customSelected;
+ private boolean initialized = false;
private String [][]fillPaths() {
LinkedList<String[]> list = new LinkedList<>();
@@ -157,6 +158,7 @@ public class LinuxtoolsPathPropertyPage extends PropertyPage {
linuxtoolsPathCombo.setSelectedValue(linuxtoolsPath.getStringValue());
Dialog.applyDialogFont(result);
updateOptionsEnable();
+ initialized = true;
return result;
}
@@ -172,26 +174,32 @@ public class LinuxtoolsPathPropertyPage extends PropertyPage {
@Override
protected void performDefaults() {
- linuxtoolsPath.loadDefault();
- linuxtoolsPathCombo.loadDefault();
- customButton.setSelection(!LinuxtoolsPathProperty.getInstance().getLinuxtoolsPathSystemDefault());
- systemEnvButton.setSelection(LinuxtoolsPathProperty.getInstance().getLinuxtoolsPathSystemDefault());
- updateOptionsEnable();
+ if (initialized) {
+ linuxtoolsPath.loadDefault();
+ linuxtoolsPathCombo.loadDefault();
+ customButton.setSelection(!LinuxtoolsPathProperty.getInstance().getLinuxtoolsPathSystemDefault());
+ systemEnvButton.setSelection(LinuxtoolsPathProperty.getInstance().getLinuxtoolsPathSystemDefault());
+ updateOptionsEnable();
+ }
}
@Override
public boolean performOk() {
- linuxtoolsPath.store();
- linuxtoolsPathCombo.store();
- getPreferenceStore().setValue(LaunchCoreConstants.LINUXTOOLS_PATH_SYSTEM_NAME, systemEnvButton.getSelection());
+ if (initialized) {
+ linuxtoolsPath.store();
+ linuxtoolsPathCombo.store();
+ getPreferenceStore().setValue(LaunchCoreConstants.LINUXTOOLS_PATH_SYSTEM_NAME, systemEnvButton.getSelection());
+ }
return super.performOk();
}
@Override
protected void performApply() {
- linuxtoolsPath.store();
- linuxtoolsPathCombo.store();
- getPreferenceStore().setValue(LaunchCoreConstants.LINUXTOOLS_PATH_SYSTEM_NAME, systemEnvButton.getSelection());
+ if (initialized) {
+ linuxtoolsPath.store();
+ linuxtoolsPathCombo.store();
+ getPreferenceStore().setValue(LaunchCoreConstants.LINUXTOOLS_PATH_SYSTEM_NAME, systemEnvButton.getSelection());
+ }
super.performApply();
}

Back to the top