From 1876248c700a87ee8e0ab702baac755b7575f099 Mon Sep 17 00:00:00 2001 From: Uwe Stieber Date: Fri, 19 Oct 2012 09:30:53 +0200 Subject: Target Explorer: Fix NPE's --- .../core/internal/EventListenerDelegate.java | 34 ++++++++++++---------- .../lm/delegates/AttachLaunchManagerDelegate.java | 15 +++++----- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/EventListenerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/EventListenerDelegate.java index e2bf6eed6..66fd835b2 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/EventListenerDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/EventListenerDelegate.java @@ -58,23 +58,25 @@ public class EventListenerDelegate implements IEventListener { IPersistenceDelegate delegate = PersistenceManager.getInstance().getDelegate(Map.class, launchConfigAttributes, false); try { Map attributes = (Map)delegate.read(Map.class, launchConfigAttributes, null); - attributes.remove(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS); - attributes.remove(ICommonLaunchAttributes.ATTR_UUID); - attributes.remove(ICommonLaunchAttributes.ATTR_LAST_LAUNCHED); - final ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); - for (Entry entry : attributes.entrySet()) { - LaunchConfigHelper.addLaunchConfigAttribute(wc, entry.getKey(), entry.getValue()); - } - ExecutorsUtil.executeInUI(new Runnable() { - @Override - public void run() { - try { - wc.doSave(); - } - catch (Exception e) { - } + if (attributes != null) { + attributes.remove(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS); + attributes.remove(ICommonLaunchAttributes.ATTR_UUID); + attributes.remove(ICommonLaunchAttributes.ATTR_LAST_LAUNCHED); + final ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); + for (Entry entry : attributes.entrySet()) { + LaunchConfigHelper.addLaunchConfigAttribute(wc, entry.getKey(), entry.getValue()); } - }); + ExecutorsUtil.executeInUI(new Runnable() { + @Override + public void run() { + try { + wc.doSave(); + } + catch (Exception e) { + } + } + }); + } } catch (Exception e) { } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/AttachLaunchManagerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/AttachLaunchManagerDelegate.java index 4a6ece148..76d5b95d7 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/AttachLaunchManagerDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/AttachLaunchManagerDelegate.java @@ -122,15 +122,16 @@ public class AttachLaunchManagerDelegate extends DefaultLaunchManagerDelegate im IPersistenceDelegate delegate = PersistenceManager.getInstance().getDelegate(Map.class, launchConfigAttributes, false); try { Map attributes = (Map)delegate.read(Map.class, launchConfigAttributes, null); - attributes.remove(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS); - attributes.remove(ICommonLaunchAttributes.ATTR_UUID); - attributes.remove(ICommonLaunchAttributes.ATTR_LAST_LAUNCHED); - for (Entry entry : attributes.entrySet()) { - launchSpec.addAttribute(entry.getKey(), entry.getValue(), true); + if (attributes != null) { + attributes.remove(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS); + attributes.remove(ICommonLaunchAttributes.ATTR_UUID); + attributes.remove(ICommonLaunchAttributes.ATTR_LAST_LAUNCHED); + for (Entry entry : attributes.entrySet()) { + launchSpec.addAttribute(entry.getKey(), entry.getValue(), true); + } } } - catch (Exception e) { - } + catch (Exception e) { /* ignored on purpose */ } } } -- cgit v1.2.3