[Title] modify for sonar
authorgreatim <jaewon81.lim@samsung.com>
Thu, 3 Jan 2013 11:32:02 +0000 (20:32 +0900)
committergreatim <jaewon81.lim@samsung.com>
Thu, 3 Jan 2013 11:32:02 +0000 (20:32 +0900)
[Desc.]
[Issue]

36 files changed:
org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/Oprofile.java
org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OpInfo.java
org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/LinuxOpcontrolProvider.java
org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/OpxmlRunner.java
org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/OprofileSAXHandler.java
org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/info/OpInfoProcessor.java
org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/OprofileComm.java
org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/checkevent/CheckEventsProcessor.java
org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/checkkernel/CheckKernelProcessor.java
org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/eventinfo/EventListProcessor.java
org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/eventinfo/OpInfoProcessor.java
org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/modeldata/ModelDataProcessor.java
org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/processor/sessions/SessionsProcessor.java
org.eclipse.linuxtools.oprofile.core/src/org/tizen/oprofile/core/provider/OpcontrolDataProvider.java
org.eclipse.linuxtools.oprofile.launch.exe/src/org/tizen/oprofile/launch/TizenOprofileLaunchDelegate.java
org.eclipse.linuxtools.oprofile.launch.exe/src/org/tizen/oprofile/launch/configuration/NormalOprofileLaunchConfigurationTabGroup.java
org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/LaunchOptions.java
org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileCounter.java
org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/OprofileUiPlugin.java
org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewDoubleClickListener.java
org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/chart/ChartControl.java
org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/editor/OprofileEditor.java
org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/handler/OprofileSaveFileHandler.java
org.eclipse.linuxtools.oprofile.ui/src/org/tizen/oprofile/ui/view/OprofileViewDoubleClickListener.java
org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchShortcut.java
org.eclipse.linuxtools.valgrind.core/src/org/eclipse/linuxtools/valgrind/core/StreamReaderThread.java
org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/TizenValgrindLaunchDelegate.java
org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/ValgrindDebugPlugin.java
org.eclipse.linuxtools.valgrind.launch/src/org/eclipse/linuxtools/valgrind/launch/ValgrindOptionsTab.java
org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifViewPart.java
org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/birt/ChartControl.java
org.eclipse.linuxtools.valgrind.massif/src/org/tizen/valgrind/massif/editor/MassifEditor.java
org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckViewPart.java
org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/ValgrindError.java
org.eclipse.linuxtools.valgrind.memcheck/src/org/tizen/valgrind/memcheck/editor/MemcheckEditor.java
org.eclipse.linuxtools.valgrind.ui/src/org/tizen/valgrind/ui/handler/ValgrindSaveFileHandler.java

index 4b4a8d7..60fe4a3 100644 (file)
@@ -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();
                }
                
index 6d55f2a..4d926eb 100644 (file)
@@ -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$
                }
index 6d5ea5f..a59516b 100644 (file)
@@ -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
index da7141f..1331f08 100644 (file)
@@ -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;
                }
index cf2fb22..954d061 100644 (file)
@@ -98,7 +98,9 @@ public class OprofileSAXHandler extends DefaultHandler {
                        try {
                                processor = (XMLProcessor) handlerClass.newInstance();
                        } catch (InstantiationException e) {
+                               e.printStackTrace();
                        } catch (IllegalAccessException e) {
+                               e.printStackTrace();
                        }
                }
                
index ef0b8ea..c64b3af 100644 (file)
@@ -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);
index b7b3b60..562603f 100644 (file)
@@ -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$
index 01a2a67..32c93ab 100644 (file)
@@ -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) {
index fed8445..05f9d85 100644 (file)
@@ -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();
index 79cd65e..4e3c5ee 100644 (file)
@@ -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;
index 3ef72a9..c4a0f62 100644 (file)
@@ -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);
index 8c9e0de..345e8c3 100644 (file)
@@ -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();
                }
                
index db5ea55..1839831 100644 (file)
@@ -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;
index 58eb594..9925475 100644 (file)
 
 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();
                                }
                        }
index e3abb94..29f5e1b 100644 (file)
@@ -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) {
index 335c4db..73076a7 100644 (file)
@@ -56,7 +56,7 @@ public class NormalOprofileLaunchConfigurationTabGroup extends ProfileLaunchConf
                        
                        TizenOprofileLaunchDelegate.checkProfilingTool(monitor);
                } catch(Exception e) {
-                       
+                       e.printStackTrace();
                }
                
                return new AbstractLaunchConfigurationTab[] { new OprofileEventConfigTab() };
index f7d2dd4..11ceeb4 100644 (file)
@@ -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();
                }
        }
        
index 875b2c0..40745ef 100644 (file)
@@ -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();
                }
        }
        
index b926604..3b4da4b 100644 (file)
@@ -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;
        }
-       
 }
index a2b6c6d..c6183b3 100644 (file)
@@ -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();
index a45e654..f9bf6b5 100644 (file)
@@ -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;
                        }
index 4a61a66..a76659f 100644 (file)
 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();
                                }       
                                
index 185acb9..44ce316 100644 (file)
@@ -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)
index 48d6c60..21a2fca 100644 (file)
@@ -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();
index 7aac480..7bdef3a 100644 (file)
@@ -219,6 +219,7 @@ public static void showErrorDialog(final String errorMessage, final String reaso
                                                                                                        }
                                                                                                }
                                                                                        } catch (CModelException e) {
+                                                                                               e.printStackTrace();
                                                                                        }
                                                                                }
                                                                        }
index fc6d1a4..8e55e2b 100644 (file)
@@ -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$
                }
        }
index 05ad726..aa46177 100644 (file)
@@ -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 {
index df3e9a3..aafb5ac 100644 (file)
@@ -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;
                        }
                }
 
index 6a97f08..f337f9b 100644 (file)
@@ -134,10 +134,10 @@ public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab {
                        {
                                impossibleLabel.setText(Messages.getString("ValgrindOptionsTab.inemul"));
                        }
-                       else
-                       {
+//                     else
+//                     {
                                // impossible
-                       }
+//                     }
                                
                        canInitialize = false;
                        return;
index c0c8326..22254ce 100644 (file)
@@ -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;
                }
index 3fdf9a9..a3dc57f 100644 (file)
@@ -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();
index a88e96f..681d625 100644 (file)
@@ -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(){
index cad41a2..80abb87 100644 (file)
@@ -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) {
index 97e446c..27883d0 100644 (file)
@@ -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")) {
                                        }
                                }
                        }
index df86659..cd50b8a 100644 (file)
@@ -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(){
index 3c219e0..c6eeb1d 100644 (file)
@@ -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)