aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamilo Bernal2012-10-16 11:33:32 (EDT)
committerRoland Grunberg2012-10-16 13:01:40 (EDT)
commit1757c7cb4e52f6cd2183617dbef45e0dc9f1be09 (patch)
tree6c29f31e30f6ccc220293b0217b66736a65d69e9
parent0a3006a0d84a904a4bb6e37a2b0104d6e06aec1c (diff)
downloadorg.eclipse.linuxtools-1757c7cb4e52f6cd2183617dbef45e0dc9f1be09.zip
org.eclipse.linuxtools-1757c7cb4e52f6cd2183617dbef45e0dc9f1be09.tar.gz
org.eclipse.linuxtools-1757c7cb4e52f6cd2183617dbef45e0dc9f1be09.tar.bz2
Add null check to PrintStream in PerfLaunchConfigurationDelegate.
In the case where perf does not run, such as in o.e.l.perf.tests, there is no available console to output to. Adding this check avoids a null pointer exception when said case occurs. Change-Id: Ic5e0444e889da087d45a7ad2e35ea39a50a511fa Reviewed-on: https://git.eclipse.org/r/8234 Tested-by: Hudson CI Reviewed-by: Roland Grunberg <rgrunber@redhat.com> IP-Clean: Roland Grunberg <rgrunber@redhat.com> Tested-by: Roland Grunberg <rgrunber@redhat.com>
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java
index 5f7b7c7..e27eee2 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java
@@ -121,15 +121,20 @@ public class PerfLaunchConfigDelegate extends ProfileLaunchConfigurationDelegate
outputTo = binaryOutCons.newOutputStream();
//Get the printstream for that console
print = new PrintStream(outputTo);
- }
- for (int i = 0; i < commandArray.length; i++) {
- print.print(commandArray[i] + " ");
+ }
+
+ if (print != null) {
+ for (int i = 0; i < commandArray.length; i++) {
+ print.print(commandArray[i] + " ");
+ }
+
+ // Print Message
+ print.println();
+ print.println("Analysing recorded perf.data, please wait...");
+ // Possibly should pass this (the console reference) on to
+ // PerfCore.Report if theres anything we ever want to spit
+ // out to user.
}
-
- //Print Message
- print.println();
- print.println("Analysing recorded perf.data, please wait...");
- //Possibly should pass this (the console reference) on to PerfCore.Report if theres anything we ever want to spit out to user.
}
//(Only for testing this line..) PerfCore.Report(config, null, null, null, "/home/thavidu/dev/eclipse-oprof2-workspace/org.eclipse.linuxtools.internal.perf.tests/resources/perf.data");