Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2018-08-31 20:15:44 +0000
committerJeff Johnston2018-08-31 22:19:09 +0000
commit0ea3da3d4a0c9fedb0dd5e91e955d300e74bc17d (patch)
treec03612848e23dddc71ceb4bb6599a1c3b8986d30
parenta9943d213852c87a6bb5cd34e47d84f5295a7392 (diff)
downloadorg.eclipse.linuxtools-0ea3da3d4a0c9fedb0dd5e91e955d300e74bc17d.tar.gz
org.eclipse.linuxtools-0ea3da3d4a0c9fedb0dd5e91e955d300e74bc17d.tar.xz
org.eclipse.linuxtools-0ea3da3d4a0c9fedb0dd5e91e955d300e74bc17d.zip
Bug 538494 - NullPointerException in PerfCore.getHostName
- fix PerfCore getHostName() to check that project URI exists before accessing - add warning message if URI doesn't exist Change-Id: Iff242a0a70f4d75358e435593683900e8fa501c5 Reviewed-on: https://git.eclipse.org/r/128479 Tested-by: CI Bot Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> (cherry picked from commit 637e48106758e0b815e39bfe97a9532da2b7e453) Reviewed-on: https://git.eclipse.org/r/128481
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/Messages.java1
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfCore.java10
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/messages.properties1
3 files changed, 12 insertions, 0 deletions
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/Messages.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/Messages.java
index 550eaa2bb3..6f986dca96 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/Messages.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/Messages.java
@@ -18,6 +18,7 @@ import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.perf.messages"; //$NON-NLS-1$
public static String MsgProxyError;
+ public static String MsgNoProjectError;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfCore.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfCore.java
index bc3e529af2..465ff622f1 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfCore.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfCore.java
@@ -16,6 +16,7 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -43,6 +44,7 @@ import org.eclipse.linuxtools.internal.perf.model.TreeParent;
import org.eclipse.linuxtools.internal.perf.ui.PerfProfileView;
import org.eclipse.linuxtools.profiling.launch.ConfigUtils;
import org.eclipse.linuxtools.tools.launch.core.factory.RuntimeProcessFactory;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
@@ -117,6 +119,14 @@ public class PerfCore {
if(project == null){
return null;
}
+
+ URI projectURI = project.getLocationURI();
+ if (projectURI == null) {
+ Status status = new Status(IStatus.WARNING, PerfPlugin.PLUGIN_ID,
+ NLS.bind(Messages.MsgNoProjectError, projectName));
+ PerfPlugin.getDefault().getLog().log(status);
+ return null;
+ }
return project.getLocationURI().getHost();
}
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/messages.properties b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/messages.properties
index 3b63b354d1..bb2c92ed0d 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/messages.properties
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/messages.properties
@@ -1 +1,2 @@
MsgProxyError=Proxy could not be instantiated.
+MsgNoProjectError=Project {0} could not be located

Back to the top