diff options
-rw-r--r-- | perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfCore.java | 41 |
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 de08398146..cc6be2d8bc 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 |