summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorWainer S. Moschetta2013-02-14 09:45:01 (EST)
committer Alexander Kurtakov2013-09-03 06:42:07 (EDT)
commit696a34b44cd7f32b23ac96f04747724d5a4841e6 (patch)
treef0b675c584d5da39f31449e091e7fbc16c35e2b7
parent92b3a9db132718547e4f3f16f5f9faaaf431c1ab (diff)
downloadorg.eclipse.linuxtools-696a34b44cd7f32b23ac96f04747724d5a4841e6.zip
org.eclipse.linuxtools-696a34b44cd7f32b23ac96f04747724d5a4841e6.tar.gz
org.eclipse.linuxtools-696a34b44cd7f32b23ac96f04747724d5a4841e6.tar.bz2
valgrind: recovery from failure on Valgrind.Command.whichversion()refs/changes/70/10370/6
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 Signed-off-by: Wainer S. Moschetta <wainersm@linux.vnet.ibm.com> Reviewed-on: https://git.eclipse.org/r/10370 Reviewed-by: Alexander Kurtakov <akurtako@redhat.com> IP-Clean: Alexander Kurtakov <akurtako@redhat.com> Tested-by: Alexander Kurtakov <akurtako@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();