From 68fd34a0a55e90325ba51e2205ca117384781dfa Mon Sep 17 00:00:00 2001 From: greatim Date: Thu, 3 Jan 2013 20:32:02 +0900 Subject: [PATCH] [Title] modify for sonar [Desc.] [Issue] --- .../eclipse/linuxtools/oprofile/core/Oprofile.java | 14 ++++++-- .../linuxtools/oprofile/core/daemon/OpInfo.java | 2 ++ .../core/linux/LinuxOpcontrolProvider.java | 10 +++--- .../oprofile/core/linux/OpxmlRunner.java | 6 +++- .../oprofile/core/opxml/OprofileSAXHandler.java | 2 ++ .../oprofile/core/opxml/info/OpInfoProcessor.java | 1 + .../src/org/tizen/oprofile/core/OprofileComm.java | 26 ++++++++++++--- .../processor/checkevent/CheckEventsProcessor.java | 7 ---- .../checkkernel/CheckKernelProcessor.java | 8 +---- .../processor/eventinfo/EventListProcessor.java | 8 +---- .../core/processor/eventinfo/OpInfoProcessor.java | 7 +--- .../processor/modeldata/ModelDataProcessor.java | 19 +++++------ .../core/processor/sessions/SessionsProcessor.java | 7 +--- .../core/provider/OpcontrolDataProvider.java | 12 ++++++- .../launch/TizenOprofileLaunchDelegate.java | 25 ++++++++++---- .../NormalOprofileLaunchConfigurationTabGroup.java | 2 +- .../launch/configuration/LaunchOptions.java | 1 + .../launch/configuration/OprofileCounter.java | 4 +-- .../linuxtools/oprofile/ui/OprofileUiPlugin.java | 7 +--- .../ui/view/OprofileViewDoubleClickListener.java | 16 ++++----- .../org/tizen/oprofile/ui/chart/ChartControl.java | 3 +- .../tizen/oprofile/ui/editor/OprofileEditor.java | 17 +++++++--- .../ui/handler/OprofileSaveFileHandler.java | 3 +- .../ui/view/OprofileViewDoubleClickListener.java | 13 +++++--- .../profiling/launch/ProfileLaunchShortcut.java | 1 + .../valgrind/core/StreamReaderThread.java | 3 +- .../launch/TizenValgrindLaunchDelegate.java | 6 ++-- .../valgrind/launch/ValgrindDebugPlugin.java | 5 +++ .../valgrind/launch/ValgrindOptionsTab.java | 6 ++-- .../linuxtools/valgrind/massif/MassifViewPart.java | 6 ++++ .../valgrind/massif/birt/ChartControl.java | 2 +- .../tizen/valgrind/massif/editor/MassifEditor.java | 29 ++++++++++++---- .../valgrind/memcheck/MemcheckViewPart.java | 17 ++++++---- .../valgrind/memcheck/ValgrindError.java | 6 ++-- .../valgrind/memcheck/editor/MemcheckEditor.java | 39 ++++++++++++++-------- .../ui/handler/ValgrindSaveFileHandler.java | 8 ++++- 36 files changed, 219 insertions(+), 129 deletions(-) diff --git a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/Oprofile.java b/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/Oprofile.java index 4b4a8d7..60fe4a3 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/Oprofile.java +++ b/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/Oprofile.java @@ -100,7 +100,11 @@ public abstract class Oprofile try { IRunnableWithProgress opxml = OpcontrolDataProvider.checkKernelModule(result); opxml.run(null); - } catch (Exception e) { + } catch (InvocationTargetException e) { + String error = "The OProfile kernel module could not be loaded"; + String reason = "An error occurred initializing OProfile for use with the plugin. Please check OProfile to be installed successfully"; + OprofileComm.showErrorDialog(error, reason , e); //$NON-NLS-1$ + } catch (InterruptedException e) { String error = "The OProfile kernel module could not be loaded"; String reason = "An error occurred initializing OProfile for use with the plugin. Please check OProfile to be installed successfully"; OprofileComm.showErrorDialog(error, reason , e); //$NON-NLS-1$ @@ -219,7 +223,9 @@ public abstract class Oprofile IRunnableWithProgress opxml = OprofileCorePlugin.getDefault().getOpxmlProvider().checkEvents(ctr, event, um, validResult); opxml.run(null); } catch (InvocationTargetException e) { + e.printStackTrace(); } catch (InterruptedException e) { + e.printStackTrace(); } catch (OpxmlException e) { OprofileCorePlugin.showErrorDialog("opxmlProvider", e); //$NON-NLS-1$ return null; @@ -245,7 +251,9 @@ public abstract class Oprofile events = new OpModelEvent[sessionList.size()]; sessionList.toArray(events); } catch (InvocationTargetException e) { + e.printStackTrace(); } catch (InterruptedException e) { + e.printStackTrace(); } catch (OpxmlException e) { OprofileCorePlugin.showErrorDialog("opxmlProvider", e); //$NON-NLS-1$ } @@ -266,7 +274,9 @@ public abstract class Oprofile opxml = OprofileCorePlugin.getDefault().getOpxmlProvider().modelData(eventName, sessionName, image); opxml.run(null); } catch (InvocationTargetException e) { + e.printStackTrace(); } catch (InterruptedException e) { + e.printStackTrace(); } catch (OpxmlException e) { OprofileCorePlugin.showErrorDialog("opxmlProvider", e); //$NON-NLS-1$ return null; @@ -290,7 +300,7 @@ public abstract class Oprofile try { if(_info==null||isValid(_info)) initializeOprofileModule(); - } catch (Exception e) { + } catch (OpcontrolException e) { e.printStackTrace(); } diff --git a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OpInfo.java b/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OpInfo.java index 6d55f2a..4d926eb 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OpInfo.java +++ b/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OpInfo.java @@ -84,7 +84,9 @@ public class OpInfo { IRunnableWithProgress opxml = OprofileCorePlugin.getDefault().getOpxmlProvider().info(info); opxml.run(null); } catch (InvocationTargetException e) { + e.printStackTrace(); } catch (InterruptedException e) { + e.printStackTrace(); } catch (OpxmlException e) { OprofileCorePlugin.showErrorDialog("opxmlProvider", e); //$NON-NLS-1$ } diff --git a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/LinuxOpcontrolProvider.java b/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/LinuxOpcontrolProvider.java index 6d5ea5f..a59516b 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/LinuxOpcontrolProvider.java +++ b/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/LinuxOpcontrolProvider.java @@ -375,14 +375,15 @@ public class LinuxOpcontrolProvider implements IOpcontrolProvider { private void runCommand(String[] comm) throws OpcontrolException { String str = OprofileComm.getCommandString(comm); - // String result=null; - try { - // result = session.run(str); - //session.run(str, null); +// String result=null; +// try { +// result = session.run(str); +// session.run(str, null); if(str.contains(_OPD_START_COLLECTION)){ str = str + " && echo start_ok"; } CommandManager.runShell(str); +/* } catch (Exception e) { String devType = null; if(null == ConnectionPlugin.getDefault().getCurrentDevice()){ @@ -396,6 +397,7 @@ public class LinuxOpcontrolProvider implements IOpcontrolProvider { throw new OpcontrolException(OprofileCorePlugin.createErrorStatus( "opcontrolRun (" + devType + ")", e)); //$NON-NLS-1$ } +*/ // ----------------------------------- // jinu removed at 20090616 diff --git a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/OpxmlRunner.java b/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/OpxmlRunner.java index da7141f..1331f08 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/OpxmlRunner.java +++ b/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/OpxmlRunner.java @@ -14,6 +14,7 @@ package org.eclipse.linuxtools.oprofile.core.linux; import java.io.IOException; import java.io.StringReader; +import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParserFactory; import org.eclipse.linuxtools.oprofile.core.OprofileCorePlugin; @@ -66,7 +67,10 @@ public class OpxmlRunner { SAXParserFactory factory = SAXParserFactory.newInstance(); try { reader = factory.newSAXParser().getXMLReader(); - } catch (Exception e) { + } catch (ParserConfigurationException e) { + e.printStackTrace(); + return false; + } catch (SAXException e) { e.printStackTrace(); return false; } diff --git a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/OprofileSAXHandler.java b/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/OprofileSAXHandler.java index cf2fb22..954d061 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/OprofileSAXHandler.java +++ b/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/OprofileSAXHandler.java @@ -98,7 +98,9 @@ public class OprofileSAXHandler extends DefaultHandler { try { processor = (XMLProcessor) handlerClass.newInstance(); } catch (InstantiationException e) { + e.printStackTrace(); } catch (IllegalAccessException e) { + e.printStackTrace(); } } diff --git a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/info/OpInfoProcessor.java b/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/info/OpInfoProcessor.java index ef0b8ea..c64b3af 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/info/OpInfoProcessor.java +++ b/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/info/OpInfoProcessor.java @@ -69,6 +69,7 @@ public class OpInfoProcessor extends XMLProcessor { try { numCounters = Integer.parseInt(_characters); } catch (NumberFormatException nfe) { + nfe.printStackTrace(); } OpInfo info = (OpInfo) callData; info._setNrCounters(numCounters); diff --git a/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/OprofileComm.java b/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/OprofileComm.java index b7b3b60..562603f 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/OprofileComm.java +++ b/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/OprofileComm.java @@ -21,6 +21,7 @@ package org.tizen.oprofile.core; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import org.eclipse.core.runtime.IStatus; @@ -42,7 +43,11 @@ public abstract class OprofileComm { try { IRunnableWithProgress opxml = OpcontrolDataProvider.checkEvent(event, count, unitmask, result); opxml.run(null); - } catch (Exception e) { + } catch (InvocationTargetException e) { + String error = "An error has occured during check event setting for OProfile"; + String reason = "An unexpected error occurred with parsing data. This might be caused by closed connection to target"; + showErrorDialog(error, reason , e); //$NON-NLS-1$ + } catch (InterruptedException e) { String error = "An error has occured during check event setting for OProfile"; String reason = "An unexpected error occurred with parsing data. This might be caused by closed connection to target"; showErrorDialog(error, reason , e); //$NON-NLS-1$ @@ -60,7 +65,11 @@ public abstract class OprofileComm { runner.run(null); events = new OpModelEvent[eventList.size()]; eventList.toArray(events); - } catch (Exception e) { + } catch (InvocationTargetException e) { + String error = "An error has occured during get detailed information of supported event for OProfile"; + String reason = "An unexpected error occurred with parsing data. This might be caused by closed connection to target"; + showErrorDialog(error ,reason, e); //$NON-NLS-1$ + } catch (InterruptedException e) { String error = "An error has occured during get detailed information of supported event for OProfile"; String reason = "An unexpected error occurred with parsing data. This might be caused by closed connection to target"; showErrorDialog(error ,reason, e); //$NON-NLS-1$ @@ -73,7 +82,12 @@ public abstract class OprofileComm { try { IRunnableWithProgress runner = OpcontrolDataProvider.getModelData(model); runner.run(null); - } catch (Exception e) { + } catch (InvocationTargetException e) { + String error = "An error has occured during get reported data in current session"; + String reason = "An unexpected error occurred with parsing data. This might be caused by closed connection to target"; + showErrorDialog(error, reason, e); //$NON-NLS-1$ + return null; + } catch (InterruptedException e) { String error = "An error has occured during get reported data in current session"; String reason = "An unexpected error occurred with parsing data. This might be caused by closed connection to target"; showErrorDialog(error, reason, e); //$NON-NLS-1$ @@ -90,7 +104,11 @@ public abstract class OprofileComm { IRunnableWithProgress runner = OpcontrolDataProvider.getEventInfo(info); runner.run(null); - } catch (Exception e) { + } catch (InvocationTargetException e) { + String error = "An error has occured during get event list in current session"; + String reason = "An unexpected error occurred with parsing data. This might be caused by closed connection to target"; + showErrorDialog(error , reason, e); //$NON-NLS-1$ + } catch (InterruptedException e) { String error = "An error has occured during get event list in current session"; String reason = "An unexpected error occurred with parsing data. This might be caused by closed connection to target"; showErrorDialog(error , reason, e); //$NON-NLS-1$ diff --git a/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/checkevent/CheckEventsProcessor.java b/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/checkevent/CheckEventsProcessor.java index 01a2a67..32c93ab 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/checkevent/CheckEventsProcessor.java +++ b/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/checkevent/CheckEventsProcessor.java @@ -33,16 +33,9 @@ public class CheckEventsProcessor { throws InterruptedException { String[] resultStr = null; - try { - // resultStr = - // session.run(COMMAND_CHECK_EVENT+" "+event+":"+count+":"+unitmask, - // null); resultStr = CommandManager .runCommandReturningResultArray(COMMAND_CHECK_EVENT + " " + event + ":" + count + ":" + unitmask); - } catch (Exception e) { - throw new InterruptedException(); - } if (resultStr != null && resultStr.length > 0 && resultStr[0].trim().length() > 0) { diff --git a/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/checkkernel/CheckKernelProcessor.java b/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/checkkernel/CheckKernelProcessor.java index fed8445..05f9d85 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/checkkernel/CheckKernelProcessor.java +++ b/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/checkkernel/CheckKernelProcessor.java @@ -32,15 +32,9 @@ public class CheckKernelProcessor { public void parse(String[] result) throws InterruptedException { String[] resultStr = null; - try { - // resultStr = session.run(COMMAND_CHECK_KERNEL, null); - resultStr = CommandManager + resultStr = CommandManager .runCommandReturningResultArray(COMMAND_CHECK_KERNEL); - } catch (Exception e) { - throw new InterruptedException(); - } - if (resultStr != null && resultStr.length > 0 && resultStr[0].trim().length() > 0) { result[0] = resultStr[0].trim(); diff --git a/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/eventinfo/EventListProcessor.java b/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/eventinfo/EventListProcessor.java index 79cd65e..4e3c5ee 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/eventinfo/EventListProcessor.java +++ b/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/eventinfo/EventListProcessor.java @@ -57,13 +57,7 @@ public class EventListProcessor { public void parse() throws InterruptedException { String resultStr = null; - try { - // resultStr = session.run(COMMAND_EVENT_LIST, null); - resultStr = CommandManager - .runCommandReturningResult(COMMAND_EVENT_LIST); - } catch (Exception e) { - throw new InterruptedException(); - } + resultStr = CommandManager.runCommandReturningResult(COMMAND_EVENT_LIST); if (resultStr == null || resultStr.trim().length() == 0) return; diff --git a/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/eventinfo/OpInfoProcessor.java b/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/eventinfo/OpInfoProcessor.java index 3ef72a9..c4a0f62 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/eventinfo/OpInfoProcessor.java +++ b/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/eventinfo/OpInfoProcessor.java @@ -36,12 +36,7 @@ public class OpInfoProcessor { public void parse() throws InterruptedException { String[] resultStr = null; - try { - // resultStr = session.run(COMMAND_COUNTER_NO, null); - resultStr = CommandManager.runCommandReturningResultArray(COMMAND_COUNTER_NO); - } catch (Exception e) { - throw new InterruptedException(); - } + resultStr = CommandManager.runCommandReturningResultArray(COMMAND_COUNTER_NO); if (resultStr != null && resultStr.length >1) { // System.out.println("######## opcontrol -l : "+resultStr); diff --git a/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/modeldata/ModelDataProcessor.java b/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/modeldata/ModelDataProcessor.java index 8c9e0de..345e8c3 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/modeldata/ModelDataProcessor.java +++ b/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/modeldata/ModelDataProcessor.java @@ -55,16 +55,13 @@ public class ModelDataProcessor{ OprofileSAXHandler handler = new OprofileSAXHandler(root); String resultStr= null; - try { - //resultStr = session.run(COMMAND_SESSION_EVENT, null); - int orgtimeout = SdbPreferences.getTimeOut(); - SdbPreferences.setTimeOut(60000); - resultStr = CommandManager.runCommandReturningResult(COMMAND_SESSION_EVENT); - SdbPreferences.setTimeOut(orgtimeout); + + //resultStr = session.run(COMMAND_SESSION_EVENT, null); + int orgtimeout = SdbPreferences.getTimeOut(); + SdbPreferences.setTimeOut(60000); + resultStr = CommandManager.runCommandReturningResult(COMMAND_SESSION_EVENT); + SdbPreferences.setTimeOut(orgtimeout); - } catch (Exception e) { - throw new InterruptedException(); - } if(resultStr==null||resultStr.trim().length() ==0){ // root.reset(); @@ -75,7 +72,9 @@ public class ModelDataProcessor{ try { saxParser.parse(new InputSource(new StringReader(resultStr)),handler); - } catch (Exception e) { + } catch (SAXException e) { + e.printStackTrace(); + } catch (IOException e) { e.printStackTrace(); } diff --git a/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/sessions/SessionsProcessor.java b/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/sessions/SessionsProcessor.java index db5ea55..1839831 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/sessions/SessionsProcessor.java +++ b/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/sessions/SessionsProcessor.java @@ -47,12 +47,7 @@ public class SessionsProcessor{ String[] resultStr= null; - try { - //resultStr = session.run(COMMAND_SESSION_EVENT, null); - resultStr = CommandManager.runCommandReturningResultArray(COMMAND_SESSION_EVENT); - } catch (Exception e) { - throw new InterruptedException(); - } + resultStr = CommandManager.runCommandReturningResultArray(COMMAND_SESSION_EVENT); if(resultStr==null||resultStr.length == 0 ) return; diff --git a/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/provider/OpcontrolDataProvider.java b/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/provider/OpcontrolDataProvider.java index 58eb594..9925475 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/provider/OpcontrolDataProvider.java +++ b/org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/provider/OpcontrolDataProvider.java @@ -20,9 +20,12 @@ package org.tizen.oprofile.core.provider; +import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; +import javax.xml.parsers.ParserConfigurationException; + import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.linuxtools.oprofile.core.daemon.OpInfo; @@ -35,6 +38,7 @@ import org.tizen.oprofile.core.processor.eventinfo.EventListProcessor; import org.tizen.oprofile.core.processor.eventinfo.OpInfoProcessor; import org.tizen.oprofile.core.processor.modeldata.ModelDataProcessor; import org.tizen.oprofile.core.processor.sessions.SessionsProcessor; +import org.xml.sax.SAXException; public abstract class OpcontrolDataProvider{ @@ -91,7 +95,13 @@ public abstract class OpcontrolDataProvider{ try { new ModelDataProcessor(model).parse(); - } catch (Exception e) { + } catch (InterruptedException e) { + throw new InterruptedException(); + } catch (SAXException e) { + throw new InterruptedException(); + } catch (IOException e) { + throw new InterruptedException(); + } catch (ParserConfigurationException e) { throw new InterruptedException(); } } diff --git a/org.eclipse.linuxtools.oprofile.launch.exe/src/org/tizen/oprofile/launch/TizenOprofileLaunchDelegate.java b/org.eclipse.linuxtools.oprofile.launch.exe/src/org/tizen/oprofile/launch/TizenOprofileLaunchDelegate.java index e3abb94..29f5e1b 100644 --- a/org.eclipse.linuxtools.oprofile.launch.exe/src/org/tizen/oprofile/launch/TizenOprofileLaunchDelegate.java +++ b/org.eclipse.linuxtools.oprofile.launch.exe/src/org/tizen/oprofile/launch/TizenOprofileLaunchDelegate.java @@ -135,6 +135,9 @@ public class TizenOprofileLaunchDelegate extends TizenLaunchDelegate { // newCoreException(TizenLaunchMessages.CANNOT_LAUNCH, // new Exception("Cannot change to run-directory : " // + ". (Return Code: " + resultRsp + ")")); + + if (monitor.isCanceled()) + throw new OperationCanceledException(); IPath exeFile = CDebugUtils.verifyProgramPath(config); remoteExePath += exeFile.toFile().getName(); @@ -155,10 +158,16 @@ public class TizenOprofileLaunchDelegate extends TizenLaunchDelegate { new Exception( "Executable does not exist on a valid path. You must install your application before running it.")); + if (monitor.isCanceled()) + throw new OperationCanceledException(); + monitor.worked(2); preProcedure(config, launch, monitor, remoteExePath); + if (monitor.isCanceled()) + throw new OperationCanceledException(); + String arguments = config .getAttribute( ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, @@ -172,18 +181,21 @@ public class TizenOprofileLaunchDelegate extends TizenLaunchDelegate { // CommandManager.runShell(cmd); runApplication(config, launch, cmd); + if (monitor.isCanceled()) + throw new OperationCanceledException(); + postProcedure(config, launch, monitor); + if (monitor.isCanceled()) + throw new OperationCanceledException(); } catch (CoreException e) { - throw e; + newCoreException(e.getMessage(), e.getCause()); + } catch (OperationCanceledException e) { + newCoreException("Operation canceled by user.", null); } catch (Exception e) { newCoreException(TizenLaunchMessages.CANNOT_LAUNCH, e); } finally { - if (monitor.isCanceled()) { - throw new OperationCanceledException(); - } else { - monitor.done(); - } + monitor.done(); } } @@ -198,6 +210,7 @@ public class TizenOprofileLaunchDelegate extends TizenLaunchDelegate { BufferedReader br = new BufferedReader(new InputStreamReader( oprofileProc.getInputStream())); while (null != br.readLine()) { + ; } br.close(); } catch (CoreException e) { diff --git a/org.eclipse.linuxtools.oprofile.launch.exe/src/org/tizen/oprofile/launch/configuration/NormalOprofileLaunchConfigurationTabGroup.java b/org.eclipse.linuxtools.oprofile.launch.exe/src/org/tizen/oprofile/launch/configuration/NormalOprofileLaunchConfigurationTabGroup.java index 335c4db..73076a7 100644 --- a/org.eclipse.linuxtools.oprofile.launch.exe/src/org/tizen/oprofile/launch/configuration/NormalOprofileLaunchConfigurationTabGroup.java +++ b/org.eclipse.linuxtools.oprofile.launch.exe/src/org/tizen/oprofile/launch/configuration/NormalOprofileLaunchConfigurationTabGroup.java @@ -56,7 +56,7 @@ public class NormalOprofileLaunchConfigurationTabGroup extends ProfileLaunchConf TizenOprofileLaunchDelegate.checkProfilingTool(monitor); } catch(Exception e) { - + e.printStackTrace(); } return new AbstractLaunchConfigurationTab[] { new OprofileEventConfigTab() }; diff --git a/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/LaunchOptions.java b/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/LaunchOptions.java index f7d2dd4..11ceeb4 100644 --- a/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/LaunchOptions.java +++ b/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/LaunchOptions.java @@ -69,6 +69,7 @@ public class LaunchOptions { _options.setKernelImageFile(config.getAttribute(OprofileLaunchPlugin.ATTR_KERNEL_IMAGE_FILE, "")); //$NON-NLS-1$ _options.setSeparateProfilesMask(config.getAttribute(OprofileLaunchPlugin.ATTR_SEPARATE_SAMPLES, OprofileDaemonOptions.SEPARATE_NONE)); } catch (CoreException e) { + e.printStackTrace(); } } diff --git a/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileCounter.java b/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileCounter.java index 875b2c0..40745ef 100644 --- a/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileCounter.java +++ b/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileCounter.java @@ -151,8 +151,8 @@ public class OprofileCounter { _daemonEvent.setProfileUser(config.getAttribute(OprofileLaunchPlugin.ATTR_COUNTER_PROFILE_USER(_number), false)); _daemonEvent.setResetCount(config.getAttribute(OprofileLaunchPlugin.ATTR_COUNTER_COUNT(_number), OprofileDaemonEvent.COUNT_UNINITIALIZED)); - } catch (CoreException ce) { - + } catch (CoreException e) { + e.printStackTrace(); } } diff --git a/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/OprofileUiPlugin.java b/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/OprofileUiPlugin.java index b926604..3b4da4b 100644 --- a/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/OprofileUiPlugin.java +++ b/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/OprofileUiPlugin.java @@ -156,11 +156,6 @@ public class OprofileUiPlugin extends AbstractUIPlugin { //jinu added at 20090602 public static double getDoubleFloor(double dblDigit, int position){ double dblCal = Math.pow(10, position); - try{ - return (int)(dblDigit*(int)dblCal) / dblCal; - }catch(Exception e){ - throw new NumberFormatException(); - } + return (int)(dblDigit*(int)dblCal) / dblCal; } - } diff --git a/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewDoubleClickListener.java b/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewDoubleClickListener.java index a2b6c6d..c6183b3 100644 --- a/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewDoubleClickListener.java +++ b/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewDoubleClickListener.java @@ -37,19 +37,17 @@ import org.eclipse.ui.PartInitException; */ public class OprofileViewDoubleClickListener implements IDoubleClickListener { public void doubleClick(DoubleClickEvent event) { - IUiModelElement element = (IUiModelElement)((TreeSelection)((TreeViewer)event.getSource()).getSelection()).getFirstElement();; - + IUiModelElement element = (IUiModelElement)((TreeSelection)((TreeViewer)event.getSource()).getSelection()).getFirstElement(); +/* if (element instanceof UiModelEvent) { // UiModelEvent event = (UiModelEvent)element; - } else if (element instanceof UiModelSession) { - /* moved into an action menu */ + // moved into an action menu } else if (element instanceof UiModelImage) { // UiModelImage image = (UiModelImage)element; - } else if (element instanceof UiModelSymbol) { - /* disable this.. for binary section such as .plt, - * this will open the binary in an editor = bad */ + // disable this.. for binary section such as .plt, + // this will open the binary in an editor = bad //jump to 1st line in the file // UiModelSymbol symbol = (UiModelSymbol)element; @@ -64,7 +62,9 @@ public class OprofileViewDoubleClickListener implements IDoubleClickListener { // e.printStackTrace(); // } // } - } else if (element instanceof UiModelSample) { + } else +*/ + if (element instanceof UiModelSample) { //jump to line number in the appropriate file UiModelSample sample = (UiModelSample)element; int line = sample.getLine(); diff --git a/org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/chart/ChartControl.java b/org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/chart/ChartControl.java index a45e654..f9bf6b5 100644 --- a/org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/chart/ChartControl.java +++ b/org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/chart/ChartControl.java @@ -21,6 +21,7 @@ package org.tizen.oprofile.ui.chart; import org.eclipse.birt.chart.device.IDeviceRenderer; +import org.eclipse.birt.chart.exception.ChartException; import org.eclipse.birt.chart.factory.GeneratedChartState; import org.eclipse.birt.chart.factory.Generator; import org.eclipse.birt.chart.factory.RunTimeContext; @@ -161,7 +162,7 @@ public class ChartControl extends Canvas implements PaintListener, ControlListen gr.render( deviceRenderer, state ); } - catch ( Exception ex ) + catch ( ChartException ex ) { paintError = ex; } diff --git a/org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/editor/OprofileEditor.java b/org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/editor/OprofileEditor.java index 4a61a66..a76659f 100644 --- a/org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/editor/OprofileEditor.java +++ b/org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/editor/OprofileEditor.java @@ -21,8 +21,10 @@ package org.tizen.oprofile.ui.editor; import java.io.File; +import java.io.IOException; import java.lang.reflect.InvocationTargetException; +import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; @@ -58,6 +60,7 @@ import org.eclipse.ui.progress.UIJob; import org.tizen.oprofile.core.processor.modeldata.handler.OprofileSAXHandler; import org.tizen.oprofile.ui.view.OprofileViewLabelProvider; +import org.xml.sax.SAXException; public class OprofileEditor extends MultiPageEditorPart { @@ -157,8 +160,8 @@ public class OprofileEditor extends MultiPageEditorPart { } Point size = gc.textExtent(text); - int offset = Math.max(0, (event.height - size.y) / 2); - // gc.drawText(text, event.x+2, event.y+offset, true); +// int offset = Math.max(0, (event.height - size.y) / 2); +// gc.drawText(text, event.x+2, event.y+offset, true); } } }); @@ -174,7 +177,9 @@ public class OprofileEditor extends MultiPageEditorPart { sourceEditor = new TextEditor(); int index = addPage(sourceEditor, getEditorInput()); setPageText(index, "Source"); - }catch(PartInitException e){} + }catch(PartInitException e) { + e.printStackTrace(); + } } private void updateTitle(){ @@ -197,7 +202,11 @@ public class OprofileEditor extends MultiPageEditorPart { try { SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser(); saxParser.parse(new File(filePath),new OprofileSAXHandler(opModel)); - } catch (Exception e) { + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } catch (SAXException e) { + e.printStackTrace(); + } catch (IOException e) { e.printStackTrace(); } diff --git a/org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/handler/OprofileSaveFileHandler.java b/org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/handler/OprofileSaveFileHandler.java index 185acb9..44ce316 100644 --- a/org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/handler/OprofileSaveFileHandler.java +++ b/org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/handler/OprofileSaveFileHandler.java @@ -124,7 +124,8 @@ public class OprofileSaveFileHandler extends AbstractHandler { try { writer = new FileWriter(fileName); writer.write(uiModel.getXML()); - }catch (Exception e) { + }catch (IOException e) { + e.printStackTrace(); }finally{ try { if (writer != null) diff --git a/org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/view/OprofileViewDoubleClickListener.java b/org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/view/OprofileViewDoubleClickListener.java index 48d6c60..21a2fca 100644 --- a/org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/view/OprofileViewDoubleClickListener.java +++ b/org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/view/OprofileViewDoubleClickListener.java @@ -47,18 +47,19 @@ import org.eclipse.ui.PartInitException; */ public class OprofileViewDoubleClickListener implements IDoubleClickListener { public void doubleClick(DoubleClickEvent event) { - IUiModelElement element = (IUiModelElement)((TreeSelection)((TreeViewer)event.getSource()).getSelection()).getFirstElement();; + IUiModelElement element = (IUiModelElement)((TreeSelection)((TreeViewer)event.getSource()).getSelection()).getFirstElement(); +/* if (element instanceof UiModelEvent) { // UiModelEvent event = (UiModelEvent)element; } else if (element instanceof UiModelSession) { - /* moved into an action menu */ + // moved into an action menu } else if (element instanceof UiModelImage) { // UiModelImage image = (UiModelImage)element; } else if (element instanceof UiModelSymbol) { - /* disable this.. for binary section such as .plt, - * this will open the binary in an editor = bad */ + // disable this.. for binary section such as .plt, + // this will open the binary in an editor = bad //jump to 1st line in the file // UiModelSymbol symbol = (UiModelSymbol)element; @@ -73,7 +74,9 @@ public class OprofileViewDoubleClickListener implements IDoubleClickListener { // e.printStackTrace(); // } // } - } else if (element instanceof UiModelSample) { + } else +*/ + if (element instanceof UiModelSample) { //jump to line number in the appropriate file UiModelSample sample = (UiModelSample)element; int line = sample.getLine(); diff --git a/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java b/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java index 7aac480..7bdef3a 100644 --- a/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java +++ b/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java @@ -219,6 +219,7 @@ public static void showErrorDialog(final String errorMessage, final String reaso } } } catch (CModelException e) { + e.printStackTrace(); } } } diff --git a/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/StreamReaderThread.java b/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/StreamReaderThread.java index fc6d1a4..8e55e2b 100644 --- a/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/StreamReaderThread.java +++ b/org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/StreamReaderThread.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.linuxtools.valgrind.core; +import java.io.IOException; import java.io.InputStreamReader; import java.io.InputStream; @@ -33,7 +34,7 @@ public class StreamReaderThread extends Thread { while ((ch = in.read()) != -1) { out.append((char) ch); } - } catch (Exception e) { + } catch (IOException e) { out.append("\n" + NLS.bind(Messages.getString("StreamReaderThread.Read_error"), e.getMessage())); //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/TizenValgrindLaunchDelegate.java b/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/TizenValgrindLaunchDelegate.java index 05ad726..aa46177 100644 --- a/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/TizenValgrindLaunchDelegate.java +++ b/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/TizenValgrindLaunchDelegate.java @@ -241,11 +241,13 @@ public class TizenValgrindLaunchDelegate extends TizenLaunchDelegate { } }); } catch (ValgrindCanceledException e) { - // do nothing + e.printStackTrace(); } catch (OperationCanceledException e) { newCoreException("Operation canceled by user.", null); } catch (CoreException e) { - throw e; + newCoreException(e.getMessage(), e.getCause()); + } catch (IOException e) { + newCoreException(TizenLaunchMessages.CANNOT_LAUNCH, e); } catch (Exception e) { newCoreException(TizenLaunchMessages.CANNOT_LAUNCH, e); } finally { diff --git a/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/ValgrindDebugPlugin.java b/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/ValgrindDebugPlugin.java index df3e9a3..aafb5ac 100644 --- a/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/ValgrindDebugPlugin.java +++ b/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/ValgrindDebugPlugin.java @@ -797,6 +797,7 @@ public class ValgrindDebugPlugin extends Plugin { processFactoryID = config.getAttribute(ATTR_PROCESS_FACTORY_ID, (String) null); } catch (CoreException e) { + e.printStackTrace(); } } if (processFactoryID != null) { @@ -1233,6 +1234,8 @@ public class ValgrindDebugPlugin extends Plugin { ERROR, DebugCoreMessages.DebugPlugin_8, exception); log(status); break; + default: + break; } } @@ -1247,6 +1250,8 @@ public class ValgrindDebugPlugin extends Plugin { case NOTIFY_EVENTS: fListener.handleDebugEvents(fEvents); break; + default: + break; } } diff --git a/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindOptionsTab.java b/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindOptionsTab.java index 6a97f08..f337f9b 100644 --- a/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindOptionsTab.java +++ b/org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindOptionsTab.java @@ -134,10 +134,10 @@ public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab { { impossibleLabel.setText(Messages.getString("ValgrindOptionsTab.inemul")); } - else - { +// else +// { // impossible - } +// } canInitialize = false; return; diff --git a/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifViewPart.java b/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifViewPart.java index c0c8326..22254ce 100644 --- a/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifViewPart.java +++ b/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifViewPart.java @@ -364,6 +364,9 @@ public class MassifViewPart extends ViewPart implements IValgrindToolView { image = MassifPlugin .imageDescriptorFromPlugin(MassifPlugin.PLUGIN_ID, "icons/call_hierarchy.gif").createImage(); //$NON-NLS-1$ + break; + default: + break; } } return image; @@ -398,6 +401,9 @@ public class MassifViewPart extends ViewPart implements IValgrindToolView { case PEAK: font = JFaceResources.getFontRegistry().getBold( JFaceResources.DIALOG_FONT); + break; + default: + break; } return font; } diff --git a/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartControl.java b/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartControl.java index 3fdf9a9..a3dc57f 100644 --- a/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartControl.java +++ b/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartControl.java @@ -187,7 +187,7 @@ public class ChartControl extends Canvas implements PaintListener, ControlListen if (buffer != null) { gc.drawImage(buffer, 0, 0); } - } catch (Exception ex) { + } catch (ChartException ex) { paintError = ex; } finally { gcImage.dispose(); diff --git a/org.eclipse.linuxtools.valgrind.massif/src/org/tizen/valgrind/massif/editor/MassifEditor.java b/org.eclipse.linuxtools.valgrind.massif/src/org/tizen/valgrind/massif/editor/MassifEditor.java index a88e96f..681d625 100644 --- a/org.eclipse.linuxtools.valgrind.massif/src/org/tizen/valgrind/massif/editor/MassifEditor.java +++ b/org.eclipse.linuxtools.valgrind.massif/src/org/tizen/valgrind/massif/editor/MassifEditor.java @@ -195,12 +195,19 @@ public class MassifEditor extends MultiPageEditorPart{ updateTitle(); - try { - loadMassifData(); - } catch (Exception e) { - e.printStackTrace(); - } - + try { + loadMassifData(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } catch (CoreException e) { + e.printStackTrace(); + } catch (SAXException e) { + e.printStackTrace(); + } } @@ -494,6 +501,9 @@ public class MassifEditor extends MultiPageEditorPart{ image = MassifPlugin .imageDescriptorFromPlugin(MassifPlugin.PLUGIN_ID, "icons/call_hierarchy.gif").createImage(); //$NON-NLS-1$ + break; + default: + break; } } return image; @@ -528,6 +538,9 @@ public class MassifEditor extends MultiPageEditorPart{ case PEAK: font = JFaceResources.getFontRegistry().getBold( JFaceResources.DIALOG_FONT); + break; + default: + break; } return font; } @@ -559,7 +572,9 @@ public class MassifEditor extends MultiPageEditorPart{ sourceEditor = new TextEditor(); int index = addPage(sourceEditor, getEditorInput()); setPageText(index, "Source"); - }catch(PartInitException e){} + }catch(PartInitException e){ + e.printStackTrace(); + } } private void updateTitle(){ diff --git a/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckViewPart.java b/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckViewPart.java index cad41a2..80abb87 100644 --- a/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckViewPart.java +++ b/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckViewPart.java @@ -16,6 +16,7 @@ import java.util.ArrayList; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.jface.action.IAction; @@ -242,8 +243,8 @@ public class MemcheckViewPart extends ViewPart implements IValgrindToolView { } } - } catch (Exception e) { - //System.out.println("Error:" + e.getMessage()); + } catch (CoreException e) { + e.printStackTrace(); } } } @@ -318,12 +319,12 @@ public class MemcheckViewPart extends ViewPart implements IValgrindToolView { try{ cnt_def_byte += Integer.valueOf(temp_byte); } - catch(Exception e){ + catch(NumberFormatException e){ try{ temp_byte = temp_byte.replace(",", ""); cnt_def_byte += Integer.valueOf(temp_byte); } - catch(Exception e1){ + catch(NumberFormatException e1){ temp_byte = temp_byte.substring(0, temp_byte.indexOf(" (")); cnt_def_byte += Integer.valueOf(temp_byte); } @@ -338,7 +339,7 @@ public class MemcheckViewPart extends ViewPart implements IValgrindToolView { try{ cnt_def_block += Integer.valueOf(temp_block); } - catch(Exception e){ + catch(NumberFormatException e){ temp_block = temp_block.replace(",", ""); cnt_def_block += Integer.valueOf(temp_block); } @@ -370,7 +371,7 @@ public class MemcheckViewPart extends ViewPart implements IValgrindToolView { try{ cnt_poss_byte += Integer.valueOf(temp_byte); } - catch(Exception e){ + catch(NumberFormatException e){ temp_byte = temp_byte.replace(",", ""); cnt_poss_byte += Integer.valueOf(temp_byte); @@ -385,7 +386,7 @@ public class MemcheckViewPart extends ViewPart implements IValgrindToolView { try{ cnt_poss_block += Integer.valueOf(temp_block); } - catch(Exception e){ + catch(NumberFormatException e){ temp_block = temp_block.replace(",", ""); cnt_poss_block += Integer.valueOf(temp_block); } @@ -496,6 +497,8 @@ public class MemcheckViewPart extends ViewPart implements IValgrindToolView { return treeElement.getPid(); case 6: return treeElement.getTid(); + default: + return null; } } if (element instanceof StackFrameTreeElement) { diff --git a/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/ValgrindError.java b/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/ValgrindError.java index 97e446c..27883d0 100644 --- a/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/ValgrindError.java +++ b/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/ValgrindError.java @@ -57,10 +57,8 @@ public class ValgrindError { Node iN = errorNodes.item(j); if(iN.getNodeName().equals("text")) { what = iN.getTextContent(); - } else if(iN.getNodeName().equals("leakedbytes")) { - - } else if(iN.getNodeName().equals("leakedblocks")) { - +// } else if(iN.getNodeName().equals("leakedbytes")) { +// } else if(iN.getNodeName().equals("leakedblocks")) { } } } diff --git a/org.eclipse.linuxtools.valgrind.memcheck/src/org/tizen/valgrind/memcheck/editor/MemcheckEditor.java b/org.eclipse.linuxtools.valgrind.memcheck/src/org/tizen/valgrind/memcheck/editor/MemcheckEditor.java index df86659..cd50b8a 100644 --- a/org.eclipse.linuxtools.valgrind.memcheck/src/org/tizen/valgrind/memcheck/editor/MemcheckEditor.java +++ b/org.eclipse.linuxtools.valgrind.memcheck/src/org/tizen/valgrind/memcheck/editor/MemcheckEditor.java @@ -125,12 +125,19 @@ public class MemcheckEditor extends MultiPageEditorPart { createSourcePage(); updateTitle(); - try { - loadMemcheckData(); - } catch (Exception e) { - e.printStackTrace(); - } - + try { + loadMemcheckData(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } catch (CoreException e) { + e.printStackTrace(); + } catch (SAXException e) { + e.printStackTrace(); + } } private void createMemcheckPage(){ @@ -298,8 +305,8 @@ public class MemcheckEditor extends MultiPageEditorPart { } } - } catch (Exception e) { - //System.out.println("Error:" + e.getMessage()); + } catch (CoreException e) { + e.printStackTrace(); } } } @@ -366,12 +373,12 @@ public class MemcheckEditor extends MultiPageEditorPart { try{ cnt_def_byte += Integer.valueOf(temp_byte); } - catch(Exception e){ + catch(NumberFormatException e){ try{ temp_byte = temp_byte.replace(",", ""); cnt_def_byte += Integer.valueOf(temp_byte); } - catch(Exception e1){ + catch(NumberFormatException e1){ temp_byte = temp_byte.substring(0, temp_byte.indexOf(" (")); cnt_def_byte += Integer.valueOf(temp_byte); } @@ -386,7 +393,7 @@ public class MemcheckEditor extends MultiPageEditorPart { try{ cnt_def_block += Integer.valueOf(temp_block); } - catch(Exception e){ + catch(NumberFormatException e){ temp_block = temp_block.replace(",", ""); cnt_def_block += Integer.valueOf(temp_block); } @@ -418,7 +425,7 @@ public class MemcheckEditor extends MultiPageEditorPart { try{ cnt_poss_byte += Integer.valueOf(temp_byte); } - catch(Exception e){ + catch(NumberFormatException e){ temp_byte = temp_byte.replace(",", ""); cnt_poss_byte += Integer.valueOf(temp_byte); @@ -433,7 +440,7 @@ public class MemcheckEditor extends MultiPageEditorPart { try{ cnt_poss_block += Integer.valueOf(temp_block); } - catch(Exception e){ + catch(NumberFormatException e){ temp_block = temp_block.replace(",", ""); cnt_poss_block += Integer.valueOf(temp_block); } @@ -523,6 +530,8 @@ public class MemcheckEditor extends MultiPageEditorPart { return treeElement.getPid(); case 6: return treeElement.getTid(); + default: + return null; } } if (element instanceof StackFrameTreeElement) { @@ -766,7 +775,9 @@ public class MemcheckEditor extends MultiPageEditorPart { sourceEditor = new TextEditor(); int index = addPage(sourceEditor, getEditorInput()); setPageText(index, "Source"); - }catch(PartInitException e){} + }catch(PartInitException e){ + e.printStackTrace(); + } } private void updateTitle(){ diff --git a/org.eclipse.linuxtools.valgrind.ui/src/org/tizen/valgrind/ui/handler/ValgrindSaveFileHandler.java b/org.eclipse.linuxtools.valgrind.ui/src/org/tizen/valgrind/ui/handler/ValgrindSaveFileHandler.java index 3c219e0..c6eeb1d 100644 --- a/org.eclipse.linuxtools.valgrind.ui/src/org/tizen/valgrind/ui/handler/ValgrindSaveFileHandler.java +++ b/org.eclipse.linuxtools.valgrind.ui/src/org/tizen/valgrind/ui/handler/ValgrindSaveFileHandler.java @@ -21,6 +21,7 @@ package org.tizen.valgrind.ui.handler; import java.io.File; +import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; @@ -147,7 +148,12 @@ public class ValgrindSaveFileHandler extends AbstractHandler { in.close(); out.close(); - }catch (Exception e) { + }catch (FileNotFoundException e) { + e.printStackTrace(); + }catch (IllegalStateException e) { + e.printStackTrace(); + }catch (IOException e) { + e.printStackTrace(); }finally{ try { if (writer != null) -- 2.7.4