COMMON : fix some potential bugs 58/32558/1
authorseokgil.kang <seokgil.kang@samsung.com>
Fri, 19 Dec 2014 01:59:06 +0000 (10:59 +0900)
committerseokgil.kang <seokgil.kang@samsung.com>
Fri, 19 Dec 2014 01:59:06 +0000 (10:59 +0900)
Change-Id: I25e083508f78640336123b58685da51955288d70
Signed-off-by: seokgil.kang <seokgil.kang@samsung.com>
org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/CommandManager.java
org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckLaunchDelegate.java
org.eclipse.linuxtools.valgrind.memcheck/src/org/tizen/valgrind/memcheck/editor/MemcheckEditor.java
org.eclipse.linuxtools.valgrind.nativelaunch.exe/src/org/eclipse/linuxtools/valgrind/launch/CommandManager.java

index 0a5aa22..e42d59e 100644 (file)
@@ -157,9 +157,11 @@ public class CommandManager {
        public static String[] runCommandReturningResult(String command) {
                IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
                CommonReceiver commonReceiver = new CommonReceiver();
-
+               String[] result = null;
                try {
                        device.executeShellCommand(command, commonReceiver);
+                       result = commonReceiver.getOutput();
+                       commonReceiver.close();
                } catch (TimeoutException e) {
                        e.printStackTrace();
                } catch (SdbCommandRejectedException e) {
@@ -169,7 +171,7 @@ public class CommandManager {
                } catch (IOException e) {
                        e.printStackTrace();
                }
-               return commonReceiver.getOutput();
+               return result;
        }
 
        public static String[] runHostCommandReturningResult(String command) {
@@ -231,6 +233,7 @@ public class CommandManager {
                finally
                {
                        tryClose( fileOut );
+                       syncService.close();
                }
                
        }
index 4832ebe..9b9e6d4 100644 (file)
@@ -89,8 +89,9 @@ public class MemcheckLaunchDelegate extends TizenLaunchDelegate implements IValg
                        SAXException {
 
                ValgrindXMLParser parser;
+               FileInputStream in = null;
                try {
-                       FileInputStream in = new FileInputStream(hostlog);
+                       in = new FileInputStream(hostlog);
                        parser = new ValgrindXMLParser(in);
                        errors = parser.getErrors();
        
@@ -99,10 +100,10 @@ public class MemcheckLaunchDelegate extends TizenLaunchDelegate implements IValg
                        if (memcheckPart instanceof MemcheckViewPart) {
                                ((MemcheckViewPart) memcheckPart).setErrors(errors.toArray(new ValgrindError[errors.size()]));
                        }
-               
-                       in.close();
                } catch (Exception e) {
                        e.printStackTrace();
+               } finally {
+                       in.close();
                }
        }
        
index 3553ae4..1206b6b 100644 (file)
@@ -811,16 +811,17 @@ public class MemcheckEditor extends MultiPageEditorPart {
        private void loadData() throws FileNotFoundException, ParserConfigurationException, IOException, CoreException, SAXException {
                ArrayList<ValgrindError> errorList = new ArrayList<ValgrindError>();
                ValgrindXMLParser parser;
+               FileInputStream in = null;
                try {
-                       FileInputStream in = new FileInputStream(this.filePath);
+                       in = new FileInputStream(this.filePath);
                        parser = new ValgrindXMLParser(in);
                        errorList.addAll(parser.getErrors());
                
                        errors = errorList.toArray(new ValgrindError[errorList.size()]);
-                       
-                       in.close();
                } catch (Exception e) {
                        e.printStackTrace();
+               } finally {
+                       in.close();
                }
        }
 
index 65843b5..9dd2a01 100644 (file)
@@ -264,6 +264,7 @@ public class CommandManager {
                        }
 //                     SyncResult result = syncService.doPush( fileIn, device.getFileEntry( dest ), null, -1 );
                        SyncResult result = syncService.push(src, device.getFileEntry(dest));
+                       syncService.close();
                        return result.isOk();
 //             }
 //             catch ( final FileNotFoundException e )