aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWainer S. Moschetta2013-02-14 09:45:01 (EST)
committerJeff Johnston2013-09-16 15:54:33 (EDT)
commitdd2c131dd78fcfd632316c8f4845137200624864 (patch)
treef855e479c6bc6f223a1b29226a8a412ed34e1f30
parent253f995d046cc234521a3e88dba8d4ad836aa5a5 (diff)
downloadorg.eclipse.linuxtools-dd2c131dd78fcfd632316c8f4845137200624864.zip
org.eclipse.linuxtools-dd2c131dd78fcfd632316c8f4845137200624864.tar.gz
org.eclipse.linuxtools-dd2c131dd78fcfd632316c8f4845137200624864.tar.bz2
valgrind: recovery from failure on Valgrind.Command.whichversion()refs/changes/81/16481/2
This patch change whichVersion() method to return an empty string when something goes wrong to determine system's valgrind version. Changed readIntoBuffer() method to also throw IOExpection when process parameter is null. Change-Id: Ie0bd3cb31804f2aa60c5a149a8ad55a301edc8a3 Reviewed-on: https://git.eclipse.org/r/16481 Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> IP-Clean: Jeff Johnston <jjohnstn@redhat.com> Tested-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/internal/valgrind/core/ValgrindCommand.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/internal/valgrind/core/ValgrindCommand.java b/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/internal/valgrind/core/ValgrindCommand.java
index 89af32d..ccf3230 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/internal/valgrind/core/ValgrindCommand.java
+++ b/valgrind/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/internal/valgrind/core/ValgrindCommand.java
@@ -33,11 +33,17 @@ public class ValgrindCommand {
public String whichVersion(IProject project) throws IOException {
StringBuffer out = new StringBuffer();
+ String version = "";
Process p = RuntimeProcessFactory.getFactory().exec(new String[] { VALGRIND_CMD, CommandLineConstants.OPT_VERSION }, project);
- readIntoBuffer(out, p);
- return out.toString().trim();
+ try {
+ readIntoBuffer(out, p);
+ version = out.toString().trim();
+ } catch(IOException e) {
+ e.printStackTrace();
+ }
+ return version;
}
-
+
public void execute(String[] commandArray, Object env, File wd, String exeFile, boolean usePty, IProject project) throws IOException {
args = commandArray;
try {
@@ -78,6 +84,9 @@ public class ValgrindCommand {
protected void readIntoBuffer(StringBuffer out, Process p) throws IOException {
boolean success;
InputStream in, err, input;
+ if (p == null ) {
+ throw new IOException("Null Process object: unabled to read input into buffer");
+ }
try {
//We need to get the inputs before calling waitFor
input = p.getInputStream();