Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOtavio Pontes2012-06-13 18:53:54 +0000
committerOtavio Pontes2012-06-13 20:16:17 +0000
commita1e209c2368a4bc154e31d91943a8b8c658034ca (patch)
treefb8c1059c284704211b6192a766b27f88a17ce28
parentd116c9fe4828bd5abaf735d0e9c90ee6e4d49dab (diff)
downloadorg.eclipse.linuxtools-a1e209c2368a4bc154e31d91943a8b8c658034ca.tar.gz
org.eclipse.linuxtools-a1e209c2368a4bc154e31d91943a8b8c658034ca.tar.xz
org.eclipse.linuxtools-a1e209c2368a4bc154e31d91943a8b8c658034ca.zip
ssh.proxy: Avoid throwing a null pointer exception
A NPE was thrown when the proxy is used inside a thread that has no access to the UI. Now we will only have a connection error.
-rw-r--r--profiling/org.eclipse.linuxtools.ssh.proxy/src/org/eclipse/linuxtools/internal/ssh/proxy/SSHBase.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/profiling/org.eclipse.linuxtools.ssh.proxy/src/org/eclipse/linuxtools/internal/ssh/proxy/SSHBase.java b/profiling/org.eclipse.linuxtools.ssh.proxy/src/org/eclipse/linuxtools/internal/ssh/proxy/SSHBase.java
index 8313c06a30..1b0440f93e 100644
--- a/profiling/org.eclipse.linuxtools.ssh.proxy/src/org/eclipse/linuxtools/internal/ssh/proxy/SSHBase.java
+++ b/profiling/org.eclipse.linuxtools.ssh.proxy/src/org/eclipse/linuxtools/internal/ssh/proxy/SSHBase.java
@@ -19,6 +19,8 @@ import org.eclipse.linuxtools.ssh.proxy.Activator;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import com.jcraft.jsch.ChannelExec;
@@ -75,7 +77,10 @@ public class SSHBase {
}
private String askPassword() throws CoreException {
- SSHPasswordDialog d = new SSHPasswordDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+ IWorkbenchWindow w = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (w == null)
+ return "";
+ SSHPasswordDialog d = new SSHPasswordDialog(w.getShell());
if (d.open() == SSHPasswordDialog.OK)
return d.getPassword();
else

Back to the top