summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorCamilo Bernal2013-04-18 14:37:39 (EDT)
committer Roland Grunberg2013-04-22 12:52:12 (EDT)
commit789be6cd4278a4e829f6669e1460608cd390aac4 (patch)
tree500ed25c7564da9abc7d7076061af51c3151d503
parentae07876ea98922d0b04ecaf480aae1cd9f58ad8e (diff)
downloadorg.eclipse.linuxtools-789be6cd4278a4e829f6669e1460608cd390aac4.zip
org.eclipse.linuxtools-789be6cd4278a4e829f6669e1460608cd390aac4.tar.gz
org.eclipse.linuxtools-789be6cd4278a4e829f6669e1460608cd390aac4.tar.bz2
Perf: Log exceptions during the different parsing stages.refs/changes/30/12030/4
Change-Id: Idaf752f3b93d443701e26c7b4f3a591738475901 Reviewed-on: https://git.eclipse.org/r/12030 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/PerfCore.java41
1 files changed, 25 insertions, 16 deletions
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 de08398..cc6be2d 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
@@ -28,7 +28,9 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.linuxtools.internal.perf.model.PMCommand;
import org.eclipse.linuxtools.internal.perf.model.PMDso;
@@ -56,7 +58,7 @@ public class PerfCore {
strBuf.append("\n");
}
} catch (IOException e) {
- e.printStackTrace();
+ logException(e);
}
String str = strBuf.toString();
if (!str.trim().equals("") && print != null) {
@@ -130,7 +132,7 @@ public class PerfCore {
return ConfigUtils.getProject(projectName);
}
} catch (CoreException e1) {
- e1.printStackTrace();
+ logException(e1);
}
}
@@ -163,7 +165,7 @@ public class PerfCore {
input = new BufferedReader(new InputStreamReader(p.getInputStream()));
} catch( IOException e ) {
- e.printStackTrace();
+ logException(e);
}
return parseEventList(input);
}
@@ -199,7 +201,7 @@ public class PerfCore {
}
}
} catch (IOException e) {
- e.printStackTrace();
+ logException(e);
} finally {
if (null != input) {
try {
@@ -222,7 +224,7 @@ public class PerfCore {
try {
p = RuntimeProcessFactory.getFactory().exec(new String [] {PerfPlugin.PERF_COMMAND, "--version"}, project);
} catch (IOException e) {
- e.printStackTrace();
+ logException(e);
}
} else {
try {
@@ -230,11 +232,11 @@ public class PerfCore {
workingDirFileStore = proxy.getResource(workingDir.toOSString());
p = RuntimeProcessFactory.getFactory().exec(new String [] {PerfPlugin.PERF_COMMAND, "--version"}, environ, workingDirFileStore, project);
} catch (IOException e) {
- e.printStackTrace();
+ logException(e);
} catch (CoreException e) {
- e.printStackTrace();
+ logException(e);
} catch (URISyntaxException e) {
- e.printStackTrace();
+ logException(e);
}
}
@@ -262,7 +264,7 @@ public class PerfCore {
}
catch (IOException e)
{
- e.printStackTrace();
+ logException(e);
return false;
}
return true;
@@ -395,9 +397,7 @@ public class PerfCore {
error = new BufferedReader(new InputStreamReader(p.getErrorStream()));
//spitting error stream moved to end of while loop, due to commenting of p.waitFor()
} catch( IOException e ) {
- e.printStackTrace();
- /*} catch (InterruptedException e) {
- e.printStackTrace();*/
+ logException(e);
}
@@ -513,7 +513,7 @@ public class PerfCore {
}
}
} catch (IOException e) {
- e.printStackTrace();
+ logException(e);
}
spitStream(error,"Perf Report", print);
@@ -565,7 +565,7 @@ public class PerfCore {
input = new BufferedReader(new InputStreamReader(p.getInputStream()));
error = new BufferedReader(new InputStreamReader(p.getErrorStream()));
} catch (IOException e) {
- e.printStackTrace();
+ logException(e);
}
PerfCore.parseAnnotation(monitor, input,
@@ -668,7 +668,7 @@ public class PerfCore {
}
}
} catch (IOException e) {
- e.printStackTrace();
+ logException(e);
}
}
@@ -683,10 +683,19 @@ public class PerfCore {
view.setContentDescription(title);
view.refreshModel();
} catch (PartInitException e) {
- e.printStackTrace();
+ logException(e);
}
}
});
}
+ /**
+ * Log specified exception.
+ * @param e Exception to log.
+ */
+ public static void logException(Exception e) {
+ Status status = new Status(IStatus.ERROR, PerfPlugin.PLUGIN_ID,
+ e.getMessage());
+ PerfPlugin.getDefault().getLog().log(status);
+ }
} \ No newline at end of file