[Title] Fixed code according to SONAR
authordonghee yang <donghee.yang@samsung.com>
Wed, 26 Dec 2012 15:57:55 +0000 (00:57 +0900)
committerdonghee yang <donghee.yang@samsung.com>
Wed, 26 Dec 2012 15:57:55 +0000 (00:57 +0900)
32 files changed:
org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformBuildPackageObjectAction.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformConfigurationManager.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/ui/GBSBuildConfigurationTab.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/GitCommander.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/PlatformMIProcessAdapter.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchDelegate.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchDelegateForAttach.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchDelegateForCore.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianMainTab.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianProjectAttachLaunchShortcut.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianProjectCoredumpLaunchShortcut.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianProjectLaunchShortcut.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingAppPage.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchUtils.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchWizard.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/ShowPackageStatusDialog.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/RPMPackageCommander.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/PackageProvider.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/AddRemotePackageDialog.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/BuildSystemTab.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/DeviceTab.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/PackageTableSelectionAdapter.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RPMPackageDialog.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RemoveInstalledPackageDialog.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RepoTableSelectionAdapter.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/PreferencesManager.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/RootstrapManager.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/CommandLauncher.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/AddRootstrapDialog.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/RootstrapView.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TizenPlatformMainWizardPage.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/ui/TizenPlatformPWComposite.java

index 91b58d7..89640ee 100644 (file)
@@ -5,23 +5,17 @@ import java.io.FilenameFilter;
 import java.lang.reflect.InvocationTargetException;
 
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
 import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.dialogs.ProgressMonitorDialog;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IObjectActionDelegate;
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.IWorkbenchWindow;
@@ -30,12 +24,6 @@ import org.eclipse.ui.PlatformUI;
 
 import org.tizen.nativecommon.build.CommonBuildMessages;
 import org.tizen.nativecommon.build.CommonBuildPackageFile;
-import org.tizen.nativecommon.build.CommonProjectDependentPackager;
-import org.tizen.nativecommon.build.ProjectTypeManager;
-import org.tizen.nativecommon.build.SmartBuildInterface;
-import org.tizen.nativecommon.build.exception.SBIException;
-import org.tizen.nativeplatform.Activator;
-import org.tizen.nativeplatform.build.PlatformCheckCancelJob;
 
 public class PlatformBuildPackageObjectAction implements IWorkbenchWindowActionDelegate, IObjectActionDelegate {
     protected IProject project;
@@ -58,17 +46,19 @@ public class PlatformBuildPackageObjectAction implements IWorkbenchWindowActionD
         ProgressMonitorDialog dialog = new ProgressMonitorDialog(window.getShell());
 
         try {
-            dialog.run(true, true, new IRunnableWithProgress() {
-                @Override
-                public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                InterruptedException {  
-                    IConfiguration config = ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration();
-                    packagingResult = PlatformProjectPackaging.RPMPackaging(project, config, monitor);
-                }
-            });
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
+                       dialog.run(true, true, new IRunnableWithProgress() {
+                           @Override
+                           public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                           InterruptedException {  
+                               IConfiguration config = ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration();
+                               packagingResult = PlatformProjectPackaging.RPMPackaging(project, config, monitor);
+                           }
+                       });
+               } catch (InvocationTargetException e1) {
+                       e1.printStackTrace();
+               } catch (InterruptedException e1) {
+                       e1.printStackTrace();
+               }
         
         if (packagingResult) {
                MessageDialog.openInformation(window.getShell(), CommonBuildMessages.BUILD_RESULT, 
index 26dcdd8..3390dc6 100644 (file)
@@ -74,6 +74,7 @@ public class PlatformConfigurationManager extends CommonConfigurationManager
                return getAllCompilerFlags( config, cpp_compiler_id );  
        }
        
+       @SuppressWarnings("deprecation")
        protected static String getAllCompilerFlags( IConfiguration config, String compilerId ) {
                
                ITool compilerTool = config.getToolsBySuperClassId(compilerId)[0];              
@@ -251,7 +252,6 @@ public class PlatformConfigurationManager extends CommonConfigurationManager
        }
        
        public static void changeToolchain(IConfiguration config, String targetId) {            
-               SmartBuildInterface sbi = SmartBuildInterface.getInstance();
                setBuildTargetName(config, targetId);           
                setToolCommand(config);
        }
index aa5601e..d16b6ba 100644 (file)
@@ -35,7 +35,6 @@ import java.util.ArrayList;
 import org.eclipse.cdt.core.settings.model.ICResourceDescription;
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
 import org.eclipse.cdt.managedbuilder.core.IManagedProject;
-import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
 import org.eclipse.cdt.managedbuilder.internal.core.MultiConfiguration;
 import org.eclipse.cdt.managedbuilder.ui.properties.AbstractCBuildPropertyTab;
 import org.eclipse.cdt.ui.newui.ICPropertyProvider;
@@ -54,6 +53,7 @@ import org.tizen.nativeplatform.build.PlatformConfigurationManager;
 import org.tizen.nativeplatform.gbs.GBSOption;
 import org.tizen.nativeplatform.gbs.GBSOptionManager;
 
+@SuppressWarnings("restriction")
 public class GBSBuildConfigurationTab extends AbstractCBuildPropertyTab {
        protected boolean checked;
        private Button option_clean;
@@ -278,7 +278,6 @@ public class GBSBuildConfigurationTab extends AbstractCBuildPropertyTab {
                        }
                });
                
-               Label space = new Label(parent, SWT.NONE);              
                Label desc = new Label(parent, SWT.NONE);
                desc.setText(getDesc(op));              
        }
index a239815..390e899 100644 (file)
@@ -105,9 +105,7 @@ public class GitCommander {
                        }               
                } catch (InterruptedException e) {
                        e.printStackTrace();
-               } finally {
-               
-        }
+               }
         
         return availableRefs; 
        }
@@ -157,8 +155,8 @@ public class GitCommander {
         ret.put(project, localPathToRepo.toFile());
         final ConnectProviderOperation op = new ConnectProviderOperation(ret);
         
-        try {
-               container.run(true, false, new IRunnableWithProgress() {
+       try {
+                       container.run(true, false, new IRunnableWithProgress() {
                                public void run(final IProgressMonitor monitor)
                                                throws InvocationTargetException {
                                        try {
@@ -181,16 +179,17 @@ public class GitCommander {
                                        }
                                }
                        });
-
-               } catch (Throwable e) {
-                       if (e instanceof InvocationTargetException) {
-                               e = e.getCause();
-                       }
-                       if (e instanceof CoreException) {
-                               IStatus status = ((CoreException) e).getStatus();
-                               e = status.getException();
-                       }
-                       //Activator.handleError(UIText.SharingWizard_failed, e, true);          
+               } catch (InvocationTargetException e1) {
+                       e1.printStackTrace();
+                       //e1 = e1.getCause();
+                       //if (e1 instanceof CoreException) {
+                       //      IStatus status = ((CoreException) e1).getStatus();
+                       //      e1 = status.getException();
+                       //}
+                       //Activator.handleError(UIText.SharingWizard_failed, e1, true);         
+               } catch (InterruptedException e1) {
+                       e1.printStackTrace();
+                       //Activator.handleError(UIText.SharingWizard_failed, e1, true);         
                }
        }
        
index 822302e..d7986d4 100644 (file)
@@ -94,7 +94,7 @@ public class PlatformMIProcessAdapter extends MIProcessAdapter {
                                bw.flush();
                                inferior.setSuspended();
                        } catch (IOException e) {
-                               //do nothing.
+                               e.printStackTrace();
                        }
                }
        }
@@ -135,13 +135,14 @@ public class PlatformMIProcessAdapter extends MIProcessAdapter {
                
                Thread syncStartup = new Thread("GDB Start") { //$NON-NLS-1$
                        public void run() {
+                               PushbackInputStream pb = new PushbackInputStream(gdbProcess.getInputStream());
+                               gdbInputStream = pb;
                                try {
-                                       PushbackInputStream pb = new PushbackInputStream(gdbProcess.getInputStream());
-                                       gdbInputStream = pb;
-                                       pb.unread(pb.read());  // actually read something, then return it
-                               } catch (Exception e) {
-                                       // Do nothing, ignore the errors
-                               }
+                                       pb.unread(pb.read());
+                               } catch (IOException e) {
+                                       e.printStackTrace();
+                               }  
+                               // actually read something, then return it
                        }
                };
                syncStartup.start();
@@ -160,7 +161,7 @@ public class PlatformMIProcessAdapter extends MIProcessAdapter {
                                try {
                                        Thread.sleep(ONE_SECOND);
                                } catch (InterruptedException e) {
-                                       // ignore
+                                       e.printStackTrace();
                                }
                        } else {
                                break;
@@ -170,7 +171,7 @@ public class PlatformMIProcessAdapter extends MIProcessAdapter {
                        syncStartup.interrupt();
                        syncStartup.join(ONE_SECOND);
                } catch (InterruptedException e) {
-                       // ignore
+                       e.printStackTrace();
                }
                if (monitor.isCanceled()) {
                        gdbProcess.destroy();
index 6777a25..92dae3f 100644 (file)
@@ -30,6 +30,7 @@ package org.tizen.nativeplatform.launch;
 
 import java.io.File;
 import java.io.FilenameFilter;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -39,10 +40,10 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription;
 import org.eclipse.cdt.debug.core.CDIDebugModel;
 import org.eclipse.cdt.debug.core.ICDIDebugger2;
 import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.core.cdi.CDIException;
 import org.eclipse.cdt.debug.core.cdi.ICDISession;
 import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
 import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants;
-import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
 import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
 import org.eclipse.cdt.launch.LaunchUtils;
 import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
@@ -60,6 +61,7 @@ import org.eclipse.core.runtime.OperationCanceledException;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.DebugException;
 import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.debug.core.ILaunchConfiguration;
@@ -69,7 +71,6 @@ import org.eclipse.debug.core.model.IProcess;
 import org.eclipse.jface.viewers.ILabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.PartInitException;
@@ -99,8 +100,11 @@ import org.tizen.nativeplatform.launch.wizards.ShowPackageStatusDialog;
 import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
 import org.tizen.sdblib.IDevice;
 import org.tizen.sdblib.IDevice.Arch;
+import org.tizen.sdblib.SdbCommandRejectedException;
 import org.tizen.sdblib.SdbShellProcess;
+import org.tizen.sdblib.TimeoutException;
 
+@SuppressWarnings("restriction")
 public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
     protected IConfiguration selectedConfig;
     protected IDevice currentDevice;
@@ -117,7 +121,7 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
         return Activator.PLUGIN_ID;
     }
 
-    public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+       public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
        shell = LaunchUIPlugin.getShell();
         if (monitor == null)
             monitor = new NullProgressMonitor();
@@ -176,7 +180,6 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
                                wc.doSave();
                        }
                } catch (CoreException e) {
-                       // TODO Auto-generated catch block
                        e.printStackTrace();
                }               
                return result;         
@@ -185,22 +188,35 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
     protected void processPostDebug(ILaunchConfiguration config)
             throws CoreException {
         if (debugSession != null) {
-            try {
-                Process process = debugSession.getSessionProcess();
-                if (process != null)
-                    process.waitFor();
-            } catch (Exception e) {
-                // do nothing
+            Process process;
+                       try {
+                               process = debugSession.getSessionProcess();
+                       } catch (CDIException e) {
+                               e.printStackTrace();
+                               process = null;
+                       }
+            if (process != null) {
+                               try {
+                                       process.waitFor();
+                               } catch (InterruptedException e) {
+                                       e.printStackTrace();
+                               }
             }
         }
         ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
         String gdbserverPort = wc.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
         if (localDebugPort != -1) {
-            try {
-                currentDevice.removeForward(localDebugPort, Integer.parseInt(gdbserverPort));
-            } catch (Exception e) {
-                // do nothing
-            }
+               try {
+                               currentDevice.removeForward(localDebugPort, Integer.parseInt(gdbserverPort));
+                       } catch (NumberFormatException e) {
+                               e.printStackTrace();
+                       } catch (TimeoutException e) {
+                               e.printStackTrace();
+                       } catch (SdbCommandRejectedException e) {
+                               e.printStackTrace();
+                       } catch (IOException e) {
+                               e.printStackTrace();
+                       }
         }
     }
     
@@ -228,7 +244,8 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
                boolean reinstallOp = config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_REINSTALL_OPTION, true);              
                boolean selectPkgOp = config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_SELECTPKG_OPTION, true);
        String appProjectName = config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_APP_PROJECT_NAME, "");      
-       ArrayList<String> extraPkgs = 
+       @SuppressWarnings("unchecked")
+               ArrayList<String> extraPkgs = 
                        (ArrayList<String>) config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_EXTRA_PACKAGE_LIST, new ArrayList<String>());
        
        ArrayList<LocalPackage> appPkgs = null;
@@ -380,7 +397,7 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
     }
 
     protected IConfiguration selectBuildConfiguration(IProject project, String arch) {
-        Shell shell = LaunchUIPlugin.getShell();
+               Shell shell = LaunchUIPlugin.getShell();
 
         ILabelProvider topprovider = new LabelProvider() {
             public String getText(Object element) {
@@ -482,6 +499,8 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
             String envCmd = setEnvironments(config);
             String execArg = setArguments(config);
             currentDevice.executeShellCommand(envCmd + execArg);
+        } catch (IOException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH, e);
         } catch (Exception e) {
             newCoreException(TizenLaunchMessages.CANNOT_LAUNCH, e);
         } finally {
@@ -516,6 +535,14 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
             String envCmd = setEnvironments(config);
             String command = envCmd + gdbserverCmd + " " + execArg;
             serverProc = currentDevice.executeShellCommand(command);
+               } catch (TimeoutException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+               } catch (SdbCommandRejectedException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+        } catch (CoreException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+        } catch (IOException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
         } catch (Exception e) {
             newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
         } finally {
@@ -549,6 +576,10 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
                         "Tizen debugger",
                         iproc, exeFile, true, false, attrDebuggerStopAtMainSymbol, true);
             }
+        } catch (DebugException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, e);
+        } catch (CoreException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, e);
         } catch (Exception e) {
             newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, e);
         } finally {
@@ -570,7 +601,15 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
             String localPort = Integer.valueOf(localDebugPort).toString();
             wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, localPort);
             wc.doSave();
-        } catch (Exception e) {
+               } catch (TimeoutException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
+               } catch (SdbCommandRejectedException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
+        } catch (CoreException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
+        } catch (IOException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
+        } catch (NumberFormatException e) {
             newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
         }
     }
index fb4479e..11500fc 100644 (file)
@@ -28,6 +28,7 @@
 */
 package org.tizen.nativeplatform.launch;
 
+import java.io.IOException;
 import java.util.ArrayList;
 
 import org.eclipse.cdt.core.IProcessInfo;
@@ -52,6 +53,8 @@ import org.tizen.nativecommon.launch.TizenLaunchMessages;
 import org.tizen.nativeplatform.build.PlatformConfigurationManager;
 import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
 import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.sdblib.SdbCommandRejectedException;
+import org.tizen.sdblib.TimeoutException;
 
 public class TizenDebianLaunchDelegateForAttach extends TizenDebianLaunchDelegate {
 
@@ -75,7 +78,13 @@ public class TizenDebianLaunchDelegateForAttach extends TizenDebianLaunchDelegat
             String localPort = Integer.valueOf(localDebugPort).toString();
             wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, localPort);
             wc.doSave();
-        } catch (Exception e) {
+               } catch (TimeoutException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
+               } catch (SdbCommandRejectedException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
+        } catch (CoreException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
+        } catch (IOException e) {
             newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
         }
     }
@@ -107,6 +116,14 @@ public class TizenDebianLaunchDelegateForAttach extends TizenDebianLaunchDelegat
             String envCmd = setEnvironments(config);
             String command = envCmd + gdbserverCmd;
             serverProc = currentDevice.executeShellCommand(command);
+               } catch (TimeoutException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+               } catch (SdbCommandRejectedException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+        } catch (CoreException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+        } catch (IOException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
         } catch (Exception e) {
             newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
         } finally {
index dac578d..d8364a5 100644 (file)
@@ -48,6 +48,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.OperationCanceledException;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.DebugException;
 import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.debug.core.ILaunchConfiguration;
@@ -153,6 +154,10 @@ public class TizenDebianLaunchDelegateForCore extends TizenDebianLaunchDelegate
                         iproc, exeFile, true, false, "false", true);
                 monitor.worked(1);
             }
+        } catch (DebugException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, e);
+        } catch (CoreException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, e);
         } catch (Exception e) {
             newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, e);
         } finally {
index 382ba03..3e6846e 100644 (file)
@@ -100,6 +100,7 @@ import org.tizen.nativeplatform.rootstrap.RootstrapManager;
 import org.tizen.sdblib.FileListingService.FileEntry;
 import org.tizen.sdblib.IDevice;
 
+@SuppressWarnings({ "deprecation", "restriction" })
 public class TizenDebianMainTab extends CMainTab {
        
        private final String BUNDLE_NAME = TizenDebianMainTab.class.getPackage().getName() + ".LaunchTabUIMessages";//$NON-NLS-1$
@@ -597,6 +598,7 @@ public class TizenDebianMainTab extends CMainTab {
                fAppProjText.setText(projectName);
        }
        
+       @SuppressWarnings("unchecked")
        protected void updateExtraTableFromConfig(ILaunchConfiguration config) {                
                ArrayList<String> pkgs = null;
                try {
@@ -681,11 +683,12 @@ public class TizenDebianMainTab extends CMainTab {
                                LocalPackage pkg = (LocalPackage)element;
                                String file = pkg.getPath();            
                                String name = new Path(file).lastSegment();
-                               String path = new Path(file).removeLastSegments(1).toOSString();
                                
                                switch(columnIndex) {
                                case 0 :
-                                       return name;                                                                                    
+                                       return name;
+                               default:
+                                       break;
                                }
                        }
                        return null;
@@ -734,6 +737,8 @@ public class TizenDebianMainTab extends CMainTab {
                                                tip.setVisible(true);
                                        }
                                }
+                               default:
+                                       break;
                        }
                }
        };
@@ -755,6 +760,8 @@ public class TizenDebianMainTab extends CMainTab {
                                case SWT.MouseExit:
                                        shell.dispose();
                                        break;
+                               default:
+                                       break;
                        }
                }
        };
index 2d4b7e3..06a426b 100644 (file)
 */
 package org.tizen.nativeplatform.launch.ui.shortcut;
 
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -52,14 +47,11 @@ import org.eclipse.cdt.debug.ui.ICDebuggerPage;
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
 import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
 import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationType;
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
@@ -81,7 +73,6 @@ import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.dialogs.ElementListSelectionDialog;
 import org.tizen.nativecommon.build.SmartBuildInterface;
 import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
-import org.tizen.nativeplatform.Activator;
 import org.tizen.nativeplatform.build.PlatformConfigurationManager;
 import org.tizen.nativeplatform.launch.ITizenLaunchConfigurationConstants;
 import org.tizen.nativeplatform.launch.wizards.PlatformAttachLaunchWizard;
@@ -93,6 +84,7 @@ import org.tizen.nativeplatform.views.model.PlatformRootstrap;
 
 
 
+@SuppressWarnings("restriction")
 public class TizenDebianProjectAttachLaunchShortcut extends CApplicationLaunchShortcut {
        
        private String programPath = null;
@@ -163,11 +155,9 @@ public class TizenDebianProjectAttachLaunchShortcut extends CApplicationLaunchSh
 
                if ( debugConfig == null ) {
                        // Prompt the user if more then 1 debugger.
-                       String os = Platform.getOS();
                        debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations();
                        List<ICDebugConfiguration> debugList = new ArrayList<ICDebugConfiguration>(debugConfigs.length);
                        for (int i = 0; i < debugConfigs.length; i++) {
-                               String platform = debugConfigs[i].getPlatform();
                                if (debugConfigs[i].supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
                                        if (debugConfigs[i].getName().contains("Tizen")) //$NON-NLS-1$
                                                debugList.add(debugConfigs[i]);
@@ -299,9 +289,6 @@ public class TizenDebianProjectAttachLaunchShortcut extends CApplicationLaunchSh
                MappingSourceContainer mappingContainer = new MappingSourceContainer("Source mapping");
                MapEntrySourceContainer entry = new MapEntrySourceContainer();
                String[] infos = launchUtils.getProjectInfo(project);
-               if (infos == null) {
-                       // TODO: error handling
-               }
                String backend = String.format("/usr/src/debug/%s-%s", infos[0], infos[1]);
                String local = project.getLocation().toOSString();
                
@@ -369,16 +356,11 @@ public class TizenDebianProjectAttachLaunchShortcut extends CApplicationLaunchSh
                        configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, fLocator.getMemento());
                        configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, fLocator.getId());
                } catch (CoreException e) {
-                       // TODO Auto-generated catch block
                        e.printStackTrace();
                }               
        }
        
-       private void newCoreException(String message, Throwable exception) throws CoreException {
-               Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message, exception);
-               throw new CoreException(status);
-       }
-       
+
        @Override
        protected ILaunchConfigurationType getCLaunchConfigType() {
                return getLaunchManager().getLaunchConfigurationType("org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForAttach");
index 821cbad..562bcfd 100644 (file)
@@ -46,7 +46,6 @@ import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationType;
@@ -70,6 +69,7 @@ import org.tizen.nativeplatform.launch.TizenDebianLaunchMessages;
 
 
 
+@SuppressWarnings("restriction")
 public class TizenDebianProjectCoredumpLaunchShortcut extends CApplicationLaunchShortcut {
        private static final String APPLICATION_PATH_INPUT_DIALOG_TITLE = "Input Tizen Application Path";
        private static final String APPLICATION_PATH_INPUT_DIALOG_TEXT = "Input Tizen Application Path : ";
@@ -134,11 +134,9 @@ public class TizenDebianProjectCoredumpLaunchShortcut extends CApplicationLaunch
 
                if ( debugConfig == null ) {
                        // Prompt the user if more then 1 debugger.
-                       String os = Platform.getOS();
                        debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations();
                        List<ICDebugConfiguration> debugList = new ArrayList<ICDebugConfiguration>(debugConfigs.length);
                        for (int i = 0; i < debugConfigs.length; i++) {
-                               String platform = debugConfigs[i].getPlatform();
                                if (debugConfigs[i].supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
                                        if (debugConfigs[i].getName().contains("Tizen")) //$NON-NLS-1$
                                                debugList.add(debugConfigs[i]);
@@ -183,7 +181,6 @@ public class TizenDebianProjectCoredumpLaunchShortcut extends CApplicationLaunch
        protected ILaunchConfiguration createConfiguration(IProject project, ICDebugConfiguration debugConfig, String mode) {
                ILaunchConfiguration config = null;
                try {
-                       String projectName = project.getProjectRelativePath().toString();
                        ILaunchConfigurationType configType = getCLaunchConfigType();
                        ILaunchConfigurationWorkingCopy wc =
                                configType.newInstance(null, getLaunchManager().generateLaunchConfigurationName(project.getName()));
index 6b457b7..a03e749 100644 (file)
@@ -50,8 +50,6 @@ import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationType;
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
@@ -60,9 +58,7 @@ import org.eclipse.debug.core.model.ISourceLocator;
 import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
 import org.eclipse.debug.core.sourcelookup.ISourceContainer;
 import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
-import org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer;
 import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer;
-import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupUIMessages;
 import org.eclipse.cdt.debug.internal.core.sourcelookup.MapEntrySourceContainer;
 import org.eclipse.debug.ui.DebugUITools;
 import org.eclipse.jface.viewers.ILabelProvider;
@@ -80,7 +76,6 @@ import org.tizen.common.util.DialogUtil;
 import org.tizen.nativecommon.build.SmartBuildInterface;
 import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
 import org.tizen.nativecommon.launch.TizenLaunchMessages;
-import org.tizen.nativeplatform.Activator;
 import org.tizen.nativeplatform.build.PlatformConfigurationManager;
 import org.tizen.nativeplatform.launch.ITizenLaunchConfigurationConstants;
 import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
@@ -91,6 +86,7 @@ import org.tizen.nativeplatform.rootstrap.RootstrapManager;
 import org.tizen.nativeplatform.views.model.PlatformRootstrap;
 import org.tizen.sdblib.IDevice;
 
+@SuppressWarnings("restriction")
 public class TizenDebianProjectLaunchShortcut extends CApplicationLaunchShortcut {
        
        private static final String APP_PROJ_DEFAULT_SELECTION = "[Not required]";
@@ -169,11 +165,9 @@ public class TizenDebianProjectLaunchShortcut extends CApplicationLaunchShortcut
 
                if ( debugConfig == null ) {
                        // Prompt the user if more then 1 debugger.
-                       String os = Platform.getOS();
                        debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations();
                        List<ICDebugConfiguration> debugList = new ArrayList<ICDebugConfiguration>(debugConfigs.length);
                        for (int i = 0; i < debugConfigs.length; i++) {
-                               String platform = debugConfigs[i].getPlatform();
                                if (debugConfigs[i].supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
                                        if (debugConfigs[i].getName().contains("Tizen")) //$NON-NLS-1$
                                                debugList.add(debugConfigs[i]);
@@ -276,11 +270,6 @@ public class TizenDebianProjectLaunchShortcut extends CApplicationLaunchShortcut
                return config;
        }
        
-       private void newCoreException(String message, Throwable exception) throws CoreException {
-               Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message, exception);
-               throw new CoreException(status);
-       }
-       
        @Override
        protected ILaunchConfigurationType getCLaunchConfigType() {
                return getLaunchManager().getLaunchConfigurationType("org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationType");
@@ -328,9 +317,6 @@ public class TizenDebianProjectLaunchShortcut extends CApplicationLaunchShortcut
                MappingSourceContainer mappingContainer = new MappingSourceContainer("Source mapping");
                MapEntrySourceContainer entry = new MapEntrySourceContainer();
                String[] infos = launchUtils.getProjectInfo(project);
-               if (infos == null) {
-                       // TODO: error handling
-               }
                String backend = String.format("/usr/src/debug/%s-%s", infos[0], infos[1]);
                String local = project.getLocation().toOSString();
                
index 4495249..990ad20 100644 (file)
@@ -52,12 +52,10 @@ import org.tizen.nativecommon.build.CommonBuildMessages;
 import org.tizen.nativecommon.build.SmartBuildInterface;
 import org.tizen.nativeplatform.Activator;
 import org.tizen.nativeplatform.views.model.PlatformRootstrap;
-import org.tizen.nativeplatform.views.ui.AddRootstrapDialog;
 import org.tizen.nativeplatform.build.PlatformConfigurationManager;
 import org.tizen.nativeplatform.build.PlatformProjectPackaging;
 import org.tizen.nativeplatform.launch.TizenDebianLaunchMessages;
 import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
-import org.tizen.nativeplatform.launch.wizards.PlatformLaunchWizard;
 import org.tizen.nativeplatform.pkgmgr.RPMPackageCommander;
 import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
 import org.tizen.nativeplatform.rootstrap.RootstrapManager;
@@ -447,7 +445,9 @@ public class PlatformLaunchSettingAppPage extends WizardPage {
                                
                                switch(columnIndex) {
                                case 0:
-                                       return name;                                                                            
+                                       return name;
+                               default:
+                                       break;
                                }
                        }
                        return null;
@@ -520,6 +520,8 @@ public class PlatformLaunchSettingAppPage extends WizardPage {
                                                tip.setVisible(true);
                                        }
                                }
+                               default:
+                                       break;
                        }
                }
        };
@@ -541,6 +543,8 @@ public class PlatformLaunchSettingAppPage extends WizardPage {
                                case SWT.MouseExit:
                                        shell.dispose();
                                        break;
+                               default:
+                                       break;
                        }
                }
        };
index 220e752..9cab74c 100644 (file)
@@ -6,7 +6,6 @@ import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.HashMap;
 
 import org.eclipse.cdt.core.IProcessInfo;
 import org.eclipse.cdt.core.IProcessList;
@@ -55,6 +54,7 @@ import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
+@SuppressWarnings("restriction")
 public class PlatformLaunchUtils {
        
        private IProcessInfo procInfo;
@@ -129,9 +129,6 @@ public class PlatformLaunchUtils {
                }    
                
                if (failedInstallPkgs != "") {
-                       String desc = String.format("Follow package does not installed successfully.\n\n" +
-                                       "%s\n" +
-                                       "See below log.", failedInstallPkgs);
                        newException(log);
                }
                monitor.worked(2);
@@ -184,7 +181,7 @@ public class PlatformLaunchUtils {
                        String msg = String.format("Follow package does not installed successfully.\n\n" +
                                        "%s\n" +
                                        "You can install package through package manager manually.", failedInstallPkgs);
-                       newException(msg);;
+                       newException(msg);
                        return false;
                }
                monitor.worked(2);
@@ -207,7 +204,6 @@ public class PlatformLaunchUtils {
        IWorkspace works = ResourcesPlugin.getWorkspace();
        IProject[] projs = works.getRoot().getProjects();
        IProject result = null;
-       HashMap<String, IProject> projectMap = new HashMap<String, IProject>();         
        for (IProject p : projs) {
                 IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(p);
              if( info == null) {
@@ -370,7 +366,6 @@ public class PlatformLaunchUtils {
        private PackageManagerOuputReceiver getNewOuputReceiver() {
                ConsoleManager cm = new ConsoleManager("debug launch", true);
                cm.clear();
-               MessageConsoleStream mcsError = cm.getMessageConsoleStream();
                MessageConsoleStream mcs = cm.getMessageConsoleStream();
                PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver();
                rec.setMessageConsoleStream(mcs);
@@ -530,12 +525,12 @@ public class PlatformLaunchUtils {
        public boolean checkGdbServerInDevice(IDevice device, TizenLaunchCommand command) throws CoreException {
                String resultCommand = TizenPlatformConstants.GDBSERVER_PLATFORM_CMD + " --version"
                 + TizenPlatformConstants.CMD_RESULT_CHECK;
-        try {
-            command.run(resultCommand, "0");
-        } catch (Exception e) {
+               try {
+                       command.run(resultCommand, "0");
+               } catch (Exception e) {
             //LaunchUtils.newCoreException(NLS.bind(TizenLaunchMessages.CANNOT_FIND_GDBSERVER, device.getDeviceName()), e);
                return false;
-        }
+               }
         
         return true;
        }
index 68c7d38..4ca81d6 100644 (file)
@@ -124,9 +124,6 @@ public class PlatformLaunchWizard extends Wizard implements IPageChangingListene
        public void pageChanged(PageChangedEvent event) {               
 
                WizardPage selectedPage = (WizardPage)event.getSelectedPage();          
-               if (selectedPage.getName().equals(SETTING_APP_PAGE)) {
-
-               }
        }
 
        @Override
index 5876141..be1386f 100644 (file)
@@ -35,7 +35,6 @@ public class ShowPackageStatusDialog extends Dialog {
        private int y = 0;
        private final int width = 800;
        private final int height = 700;
-       private Shell shell;    
                
        private TableViewer bsViewer;
        private TableViewer dvViewer;
@@ -47,7 +46,6 @@ public class ShowPackageStatusDialog extends Dialog {
        public ShowPackageStatusDialog(Shell parentShell, 
                        ArrayList<LocalPackage> bsPkgs, ArrayList<LocalPackage> dvPkgs) {
                super(parentShell);
-               this.shell = parentShell;
                Rectangle bounds = parentShell.getBounds();
         x = bounds.x + (bounds.width - width)/2;
         y = bounds.y + (bounds.height - height)/2;
@@ -193,7 +191,6 @@ public class ShowPackageStatusDialog extends Dialog {
                                {
                                        Package pkg = (Package)event.item.getData();
                                        pkg.setCheckColumn( !pkg.getCheckColumn() );
-                                       boolean b = pkg.getCheckColumn();
                                }
                        }
                });
index 820ab68..1fe581d 100644 (file)
@@ -1,31 +1,31 @@
 /*
-*  Inhouse
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ *  Inhouse
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Taejun Ha <taejun.ha@samsung.com>
+ * Jiil Hyoun <jiil.hyoun@samsung.com>
+ * Donghyuk Yang <donghyuk.yang@samsung.com>
+ * Hoon Kang <h245.kang@samsung.com>  
+ * DongHee Yang <donghee.yang@samsung.com>
+ 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
 package org.tizen.nativeplatform.pkgmgr;
 
 import java.io.File;
@@ -50,8 +50,12 @@ import org.tizen.nativeplatform.pkgmgr.PackageManagerOuputReceiver;
 import org.tizen.nativeplatform.pkgmgr.model.Package;
 import org.tizen.nativeplatform.util.CommandLauncher;
 import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.IShellOutputReceiver;
+import org.tizen.sdblib.SdbCommandRejectedException;
+import org.tizen.sdblib.ShellCommandUnresponsiveException;
 import org.tizen.sdblib.SyncService;
 import org.tizen.sdblib.SyncService.SyncResult;
+import org.tizen.sdblib.TimeoutException;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -59,91 +63,122 @@ import org.xml.sax.SAXException;
 public class RPMPackageCommander {
 
        private final static int MAX_TIMEOUT = 10000;
-       private static String http_proxy = "";  
+       private static String http_proxy = "";
        private static final String REMOVE_PKGS = "rpm-x86-arm";
-       
-       private static final String BUNDLE_NAME = RPMPackageCommander.class.getPackage().getName() + ".RPMPackageCommands";
-       private static ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
-       
-       public RPMPackageCommander() {          
-       }       
-       
+
+       private static final String BUNDLE_NAME = RPMPackageCommander.class
+                       .getPackage().getName() + ".RPMPackageCommands";
+       private static ResourceBundle resources = ResourceBundle
+                       .getBundle(BUNDLE_NAME);
+
+       public RPMPackageCommander() {
+       }
+
        public static void setHttpProxy(String proxy) {
                http_proxy = proxy;
-       }       
+       }
 
-       
        public static void DistUpgradeRootstrap(String path,
-                       IProgressMonitor monitor ) throws InterruptedException {
-               
+                       IProgressMonitor monitor) throws InterruptedException {
+
                actionBeforeUseZypper(path);
 
-               String command = getChrootedCommand(path, 
-                               String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getDistUpgradeCmd()));
-               
-               CommandLauncher.executeSudo(command, null, "Platform Internal", monitor);               
+               String command = getChrootedCommand(path, String.format("%s;%s;%s",
+                               getProxyCmd(), getResetDbCmd(), getDistUpgradeCmd()));
+
+               CommandLauncher
+                               .executeSudo(command, null, "Platform Internal", monitor);
        }
-       
-       
+
        public static void InstallLocalPkgToRootstrap(ArrayList<String> fileList,
                        String path, IProgressMonitor monitor) throws InterruptedException {
-               
+
                actionBeforeUseZypper(path);
 
                // copy
                ArrayList<String> fileListOnRootstrap = new ArrayList<String>();
-       for (String filePath : fileList) {                      
+               for (String filePath : fileList) {
                        String filename = new File(filePath).getName();
                        String pathOnRootstrap = "/tmp/" + filename;
                        try {
                                FileUtil.copyTo(filePath, path + pathOnRootstrap);
                        } catch (IOException e) {
-                               //do nothing
+                               e.printStackTrace();
+                               continue;
                        }
                        fileListOnRootstrap.add(pathOnRootstrap);
-       }       
+               }
 
-               // install 
-               String cmd = String.format("%s;%s", getResetDbCmd(), getInstallLocalPkgCmd(fileListOnRootstrap));               
+               // install
+               String cmd = String.format("%s;%s", getResetDbCmd(),
+                               getInstallLocalPkgCmd(fileListOnRootstrap));
                String command = getChrootedCommand(path, cmd);
-               CommandLauncher.executeSudo(command, null, "Platform Internal", monitor);               
+               CommandLauncher
+                               .executeSudo(command, null, "Platform Internal", monitor);
        }
 
-       
-       public static void InstallLocalPkgToDevice(ArrayList<String> fileList, IDevice device) {
+       public static void InstallLocalPkgToDevice(ArrayList<String> fileList,
+                       IDevice device) {
                actionBeforeUseZypperDevice(device);
 
-               try {
-                       // copy
-                       ArrayList<String> fileListOnDevice = new ArrayList<String>();
-               for (String filePath : fileList) {                      
-                               String filename = new File(filePath).getName();
-                               String pathOnDevice = "/tmp/" + filename;
-                               SyncService syncService = device.getSyncService();
-                               SyncResult syncResult = syncService.pushFile(filePath, pathOnDevice, SyncService.getNullProgressMonitor());
-                               if (syncResult.getCode() != SyncService.RESULT_OK) {
-                                       continue;
-                               }
-                               fileListOnDevice.add(pathOnDevice);
-               }       
-
-               // set update mode
-                       PackageManagerOuputReceiver rec = getNewOuputReceiver();
-                       rec.cleanLog();
-                       if (!device.isEmulator()) {
-                               RPMPackageCommander.changeUpdateModeForDevice(device, rec);
+               // copy
+               ArrayList<String> fileListOnDevice = new ArrayList<String>();
+               for (String filePath : fileList) {
+                       String filename = new File(filePath).getName();
+                       String pathOnDevice = "/tmp/" + filename;
+                       SyncService syncService;
+                       try {
+                               syncService = device.getSyncService();
+                       } catch (TimeoutException e) {
+                               e.printStackTrace();
+                               continue;
+                       } catch (SdbCommandRejectedException e) {
+                               e.printStackTrace();
+                               continue;
+                       } catch (IOException e) {
+                               e.printStackTrace();
+                               continue;
+                       }
+                       SyncResult syncResult = syncService.pushFile(filePath,
+                                       pathOnDevice, SyncService.getNullProgressMonitor());
+                       if (syncResult.getCode() != SyncService.RESULT_OK) {
+                               continue;
                        }
+                       fileListOnDevice.add(pathOnDevice);
+               }
 
-               // install
-               String command = String.format("%s;%s", getResetDbCmd(), getInstallLocalPkgCmdWithRPM(fileListOnDevice));
-                       device.executeShellCommand(command, rec, MAX_TIMEOUT);                          
-               } catch (Exception e1) {
-                       e1.printStackTrace();
+               // set update mode
+               PackageManagerOuputReceiver rec = getNewOuputReceiver();
+               rec.cleanLog();
+               if (!device.isEmulator()) {
+                       RPMPackageCommander.changeUpdateModeForDevice(device, rec);
                }
+
+               // install
+               String command = String.format("%s;%s", getResetDbCmd(),
+                               getInstallLocalPkgCmdWithRPM(fileListOnDevice));
+               executeDeviceShellCommand(device, command, rec);
        }
-       
 
-       public static Document InstallPkgWithZypperXmlOut(String path, String pkgs, boolean refresh, boolean force) {
+       
+       private static void executeDeviceShellCommand( IDevice device, 
+                       String command, IShellOutputReceiver rec ) {
+               try {
+                       device.executeShellCommand(command, rec, MAX_TIMEOUT );
+               } catch (TimeoutException e) {
+                       e.printStackTrace();
+               } catch (SdbCommandRejectedException e) {
+                       e.printStackTrace();
+               } catch (ShellCommandUnresponsiveException e) {
+                       e.printStackTrace();
+               } catch (IOException e) {
+                       e.printStackTrace();
+               }
+       }
+       
+       
+       public static Document InstallPkgWithZypperXmlOut(String path, String pkgs,
+                       boolean refresh, boolean force) {
                String log = "";
                if (refresh) {
                        refreshRepositoryForRootstrap(path);
@@ -153,20 +188,17 @@ public class RPMPackageCommander {
                if (force) {
                        additionOp = "--force";
                }
-               String cmd = String.format("%s;%s", getProxyCmd(), getInstallPkgWithZypper(basicOp, additionOp, pkgs));
+               String cmd = String.format("%s;%s", getProxyCmd(),
+                               getInstallPkgWithZypper(basicOp, additionOp, pkgs));
                String command = getChrootedCommand(path, cmd);
-               
-               try {
-                       log = CommandLauncher.executeSudoOutput(command, null, true);           
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }
-               
+
+               log = executeSudoOutputCommand(command, null, true);
+
                if (log.contains("<?xml")) {
                        int index = log.indexOf("<?xml");
                        log = log.substring(index);
                }
-               
+
                Document doc = null;
                StringReader sr = new StringReader(log);
                InputSource is = new InputSource(sr);
@@ -176,234 +208,241 @@ public class RPMPackageCommander {
                        db = dbf.newDocumentBuilder();
                        doc = db.parse(is);
                } catch (ParserConfigurationException e) {
-                       // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (SAXException e) {
-                       // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (IOException e) {
-                       // TODO Auto-generated catch block
                        e.printStackTrace();
                }
 
                return doc;
        }
+
+       
+       private static String executeSudoOutputCommand( String command ) {
+               try {
+                       return CommandLauncher.executeSudoOutput(command, null, false, null);
+               } catch (InterruptedException e1) {
+                       return "";
+               }
+       }
        
-       public static void uninstallPkgFromRootstrap(CopyOnWriteArrayList<Package> pkgList,
-                       String path, IProgressMonitor monitor) throws InterruptedException {            
 
-               String cmd = String.format("%s;%s", getResetDbCmd(), getUninstallPkgCmd(pkgList));              
-               String command = getChrootedCommand(path, cmd);
-               
-               CommandLauncher.executeSudo(command, null, "Platform Internal", monitor);               
+       private static String executeSudoOutputCommand( String command, String workingDir,
+               boolean includeStdErr ) {
+               try {
+                       return CommandLauncher.executeSudoOutput(command, workingDir, includeStdErr, null);
+               } catch (InterruptedException e1) {
+                       return "";
+               }
        }
+
        
+       public static void uninstallPkgFromRootstrap(
+                       CopyOnWriteArrayList<Package> pkgList, String path,
+                       IProgressMonitor monitor) throws InterruptedException {
+
+               String cmd = String.format("%s;%s", getResetDbCmd(),
+                               getUninstallPkgCmd(pkgList));
+               String command = getChrootedCommand(path, cmd);
+
+               CommandLauncher
+                               .executeSudo(command, null, "Platform Internal", monitor);
+       }
 
-       public static void uninstallPkgFromDevice(CopyOnWriteArrayList<Package> pkgList, IDevice device) {              
-               try {                   
+       public static void uninstallPkgFromDevice(
+                       CopyOnWriteArrayList<Package> pkgList, IDevice device) {
                        PackageManagerOuputReceiver rec = getNewOuputReceiver();
-                       String command = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getUninstallPkgCmd(pkgList));
+                       String command = String.format("%s;%s;%s", getProxyCmd(),
+                                       getResetDbCmd(), getUninstallPkgCmd(pkgList));
                        rec.cleanLog();
-                       device.executeShellCommand(command, rec, MAX_TIMEOUT);
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }               
+                       executeDeviceShellCommand(device, command, rec);
        }
-       
 
-       public static void UninstallPkgFromRootstrapNoDeps(String fileList, String path) {              
+       public static void UninstallPkgFromRootstrapNoDeps(String fileList,
+                       String path) {
 
-               String cmd = String.format("%s;%s", getResetDbCmd(), getUninstallPkgCmdNoDeps(fileList));               
+               String cmd = String.format("%s;%s", getResetDbCmd(),
+                               getUninstallPkgCmdNoDeps(fileList));
                String command = getChrootedCommand(path, cmd);
-               
+
                try {
-                       CommandLauncher.executeSudo(command, null, "Platform Internal", null);          
-               } catch (Exception e) {
-                       // TODO Auto-generated catch block
+                       CommandLauncher.executeSudo(command, null, "Platform Internal",
+                                       null);
+               } catch (InterruptedException e) {
                        e.printStackTrace();
-               }       
+               }
        }
 
-       
        public static String getArchForFile(String filePath) {
                try {
-                       return CommandLauncher.executeOutput(getQueryInfoCmd("ARCH", filePath));
+                       return CommandLauncher.executeOutput(getQueryInfoCmd("ARCH",
+                                       filePath));
                } catch (InterruptedException e) {
                        return "";
                }
        }
-       
-       
+
        public static String getPkgNameForFile(String filePath) {
                try {
-                       return CommandLauncher.executeOutput(getQueryInfoCmd("NAME", filePath));
+                       return CommandLauncher.executeOutput(getQueryInfoCmd("NAME",
+                                       filePath));
                } catch (InterruptedException e) {
                        return "";
                }
        }
-       
-       
-       public static String getPkgVerForFile(String filePath) {        
+
+       public static String getPkgVerForFile(String filePath) {
                String version;
                String release;
                try {
-                       version = CommandLauncher.executeOutput(getQueryInfoCmd("VERSION", filePath));
-                       release = CommandLauncher.executeOutput(getQueryInfoCmd("RELEASE", filePath));
+                       version = CommandLauncher.executeOutput(getQueryInfoCmd("VERSION",
+                                       filePath));
+                       release = CommandLauncher.executeOutput(getQueryInfoCmd("RELEASE",
+                                       filePath));
                } catch (InterruptedException e) {
                        return "";
-               }               
-               
-               return  version + "-" + release;        
+               }
+
+               return version + "-" + release;
        }
-       
-       
-       public static String getPkgInstalledVerForRootstrap(String pkgName, String path) {
+
+       public static String getPkgInstalledVerForRootstrap(String pkgName,
+                       String path) {
                String retStr = "";
                String version = "";
                String release = "";
-                               
+
                if (!pkgInstalledSuccessfullyForRootstrap(pkgName, path)) {
                        return retStr;
-               }       
-               
+               }
+
                String result = null;
-               String cmd = String.format("%s;%s", getResetDbCmd(), getShowPkgInfoCmd(pkgName));               
+               String cmd = String.format("%s;%s", getResetDbCmd(),
+                               getShowPkgInfoCmd(pkgName));
                String command = getChrootedCommand(path, cmd);
-               
-               try {
-                       result = CommandLauncher.executeSudoOutput(command);            
-               } catch (Exception e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }               
-               
+
+               result = executeSudoOutputCommand(command);
+
                String[] splitResult = result.split("\n");
                for (String r : splitResult) {
                        if (r.trim().startsWith("Version")) {
-                               version = r.split(":")[1].trim();                               
+                               version = r.split(":")[1].trim();
                        } else if (r.trim().startsWith("Release")) {
-                               release = r.split(":")[1].trim();                               
+                               release = r.split(":")[1].trim();
                        }
                }
-               
-               retStr = version + "-" + release;               
+
+               retStr = version + "-" + release;
                return retStr;
        }
-       
-       public static String getPkgInstalledVerForDevice(String pkgName, IDevice device, PackageManagerOuputReceiver rec) {             
+
+       public static String getPkgInstalledVerForDevice(String pkgName,
+                       IDevice device, PackageManagerOuputReceiver rec) {
                String retStr = "";
                String version = "";
                String release = "";
-               
+
                if (device != null) {
                        if (!pkgInstalledSuccessfullyForDevice(pkgName, device, rec)) {
                                return retStr;
                        }
-                       
-                       try {                           
-                               String command = String.format("%s;%s", getResetDbCmd(), getShowPkgInfoCmd(pkgName));
-                               rec.cleanLog();
-                               device.executeShellCommand(command, rec, MAX_TIMEOUT);
-                               for (String l : rec.getLog()) {
-                                       if (l.trim().startsWith("Version")) {
-                                               version = l.split(":")[1].trim();                                               
-                                       } else if (l.trim().startsWith("Release")) {
-                                               release = l.split(":")[1].trim();                               
-                                       }
-                               }                                                       
-                               
-                       } catch (Exception e1) {
-                               e1.printStackTrace();
+
+                       String command = String.format("%s;%s", getResetDbCmd(),
+                                       getShowPkgInfoCmd(pkgName));
+                       rec.cleanLog();
+                       executeDeviceShellCommand(device, command, rec);
+                       for (String l : rec.getLog()) {
+                               if (l.trim().startsWith("Version")) {
+                                       version = l.split(":")[1].trim();
+                               } else if (l.trim().startsWith("Release")) {
+                                       release = l.split(":")[1].trim();
+                               }
                        }
                }
-               
-               retStr = version + "-" + release;               
+
+               retStr = version + "-" + release;
                return retStr;
        }
-       
-       public static boolean pkgInstalledSuccessfullyForRootstrap(String pkgName, String path) {
-               
-               boolean ret = false;            
-               String result = "";             
-               
-               String cmd = String.format("%s;%s", getResetDbCmd(), getShowPkgCmd(pkgName));           
+
+       public static boolean pkgInstalledSuccessfullyForRootstrap(String pkgName,
+                       String path) {
+
+               boolean ret = false;
+               String result = "";
+
+               String cmd = String.format("%s;%s", getResetDbCmd(),
+                               getShowPkgCmd(pkgName));
                String command = getChrootedCommand(path, cmd);
-               
-               try {
-                       result = CommandLauncher.executeSudoOutput(command);            
-               } catch (Exception e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }
-                               
+
+               result = executeSudoOutputCommand(command);
+
                if (!result.isEmpty() && result.contains(pkgName)) {
                        ret = true;
                }
-                               
+
                return ret;
        }
-       
-       public static boolean pkgInstalledSuccessfullyForDevice(String pkgName, IDevice device, PackageManagerOuputReceiver rec) {              
-               
+
+       public static boolean pkgInstalledSuccessfullyForDevice(String pkgName,
+                       IDevice device, PackageManagerOuputReceiver rec) {
+
                boolean ret = false;
-               
+
                if (device != null) {
-                       try {
-                               String command = String.format("%s;%s", getResetDbCmd(), getShowPkgCmd(pkgName));
-                               device.executeShellCommand(command, rec, MAX_TIMEOUT);                          
-                       } catch (Exception e1) {
-                               e1.printStackTrace();
-                       }
+                       String command = String.format("%s;%s", getResetDbCmd(),
+                                       getShowPkgCmd(pkgName));
+                       executeDeviceShellCommand(device, command, rec);
                }
-               
+
                if (rec.getLog() == null) {
                        return false;
                }
-               
+
                for (String l : rec.getLog()) {
                        if (l.contains(pkgName)) {
                                ret = true;
                        }
-               }                       
-               
-               return ret;     
+               }
+
+               return ret;
        }
-       
-       
+
        public static ArrayList<Package> getPackageListForRootstrap(String path,
-                       IProgressMonitor monitor ) throws InterruptedException {
-               
+                       IProgressMonitor monitor) throws InterruptedException {
+
                ArrayList<Package> packageList = new ArrayList<Package>();
                Hashtable<String, Package> packageHash = new Hashtable<String, Package>();
-               
+
                // get list using zypper
-               String cmd = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getRemotePkgListCmd());
+               String cmd = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(),
+                               getRemotePkgListCmd());
                String command = getChrootedCommand(path, cmd);
-               String result = CommandLauncher.executeSudoOutput(command, null, false, monitor);
+               String result = CommandLauncher.executeSudoOutput(command, null, false,
+                               monitor);
                String[] splitStr = result.split("\n");
-               for (String s : splitStr ) {
+               for (String s : splitStr) {
                        s = s.replaceAll(" ", "");
                        String[] part = s.split("\\|");
-                       if ( part.length == 5 && !part[0].equals("S")) {
-                               String name = part[2]; 
-                               String version = part[3]; 
+                       if (part.length == 5 && !part[0].equals("S")) {
+                               String name = part[2];
+                               String version = part[3];
                                String arch = part[4];
-                               if ( part[0].equals("i") ) {
-                                       packageHash.put(name, new Package(name,version,version,arch) );
-                               }
-                               else if ( part[0].equals("v") ) {
+                               if (part[0].equals("i")) {
+                                       packageHash.put(name, new Package(name, version, version,
+                                                       arch));
+                               } else if (part[0].equals("v")) {
                                        Package p = packageHash.get(name);
-                                       if ( p != null ) {
-                                               if ( version.compareTo( p.getNewVersion() ) > 0  ) {
+                                       if (p != null) {
+                                               if (version.compareTo(p.getNewVersion()) > 0) {
                                                        p.setNewVersion(version);
                                                }
+                                       } else {
+                                               packageHash.put(name, new Package(name, version,
+                                                               version, arch));
                                        }
-                                       else {
-                                               packageHash.put(name, new Package(name,version,version,arch) );
-                                       }
-                               }
-                               else {
-                                       packageHash.put(name, new Package(name,"",version,arch) );
+                               } else {
+                                       packageHash.put(name, new Package(name, "", version, arch));
                                }
                        }
                }
@@ -416,29 +455,27 @@ public class RPMPackageCommander {
                for (String s : splitStr) {
                        s = s.replaceAll(" ", "").trim();
                        String[] part = s.split(",");
-                       if ( part.length == 3 ) {
-                               String name = part[0]; 
-                               String version = part[1]; 
+                       if (part.length == 3) {
+                               String name = part[0];
+                               String version = part[1];
                                String arch = part[2];
                                Package pkg = packageHash.get(name);
-                               if ( pkg == null ) {
-                                       packageHash.put(name, new Package(name,version,"",arch));
-                               }
-                               else {
+                               if (pkg == null) {
+                                       packageHash.put(name, new Package(name, version, "", arch));
+                               } else {
                                        pkg.setInstalledVersion(version);
                                }
                        }
                }
-               
+
                Enumeration<Package> e = packageHash.elements();
-               while(e.hasMoreElements()) {
+               while (e.hasMoreElements()) {
                        packageList.add(e.nextElement());
                }
-               
+
                return packageList;
        }
-       
-       
+
        public static ArrayList<Package> getPackageListForDevice(IDevice device) {
                actionBeforeUseZypperDevice(device);
 
@@ -446,319 +483,282 @@ public class RPMPackageCommander {
                Hashtable<String, Package> packageHash = new Hashtable<String, Package>();
                PackageManagerOuputReceiver rec = getNewOuputReceiver();
                rec.setPrintConsole(false);
-               try {
-                       // get list using zypper
-                       String command = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getRemotePkgListCmd());
-                       rec.cleanLog();
-                       device.executeShellCommand(command, rec, MAX_TIMEOUT);
-                       for (String s : rec.getLog() ) {
-                               s = s.replaceAll(" ", "");
-                               String[] part = s.split("\\|");
-                               if ( part.length == 5 && !part[0].equals("S")) {
-                                       String name = part[2]; 
-                                       String version = part[3]; 
-                                       String arch = part[4];
-                                       if ( part[0].equals("i") ) {
-                                               packageHash.put(name, new Package(name,version,version,arch) );
-                                       }
-                                       else if ( part[0].equals("v") ) {
-                                               Package p = packageHash.get(name);
-                                               if ( p != null && version.compareTo( p.getNewVersion() ) > 0  ) {
-                                                       p.setNewVersion(version);
-                                               }
-                                               else {
-                                                       packageHash.put(name, new Package(name,"",version,arch) );
-                                               }
-                                       }
-                                       else {
-                                               packageHash.put(name, new Package(name,"",version,arch) );
+
+               // get list using zypper
+               String command = String.format("%s;%s;%s", getProxyCmd(),
+                               getResetDbCmd(), getRemotePkgListCmd());
+               rec.cleanLog();
+               executeDeviceShellCommand(device, command, rec);
+               for (String s : rec.getLog()) {
+                       s = s.replaceAll(" ", "");
+                       String[] part = s.split("\\|");
+                       if (part.length == 5 && !part[0].equals("S")) {
+                               String name = part[2];
+                               String version = part[3];
+                               String arch = part[4];
+                               if (part[0].equals("i")) {
+                                       packageHash.put(name, new Package(name, version,
+                                                       version, arch));
+                               } else if (part[0].equals("v")) {
+                                       Package p = packageHash.get(name);
+                                       if (p != null
+                                                       && version.compareTo(p.getNewVersion()) > 0) {
+                                               p.setNewVersion(version);
+                                       } else {
+                                               packageHash.put(name, new Package(name, "",
+                                                               version, arch));
                                        }
+                               } else {
+                                       packageHash.put(name, new Package(name, "", version,
+                                                       arch));
                                }
                        }
+               }
 
-                       // get installed packages using rpm
-                       command = String.format("%s;%s", getResetDbCmd(), getInstalledPkgListCmdDevice());
-                       rec.cleanLog();
-                       device.executeShellCommand(command, rec, MAX_TIMEOUT);
-                       for (String s : rec.getLog()) {
-                               s = s.replaceAll(" ", "").trim();
-                               String[] part = s.split(",");
-                               if ( part.length == 3 ) {
-                                       String name = part[0];
-                                       String version = part[1]; 
-                                       String arch = part[2];
-                                       Package pkg = packageHash.get(name);
-                                       if ( pkg == null ) {
-                                               packageHash.put(name, new Package(name,version,"",arch));
-                                       }
-                                       else {
-                                               pkg.setInstalledVersion(version);
-                                       }
+               // get installed packages using rpm
+               command = String.format("%s;%s", getResetDbCmd(),
+                               getInstalledPkgListCmdDevice());
+               rec.cleanLog();
+               executeDeviceShellCommand(device, command, rec);
+               for (String s : rec.getLog()) {
+                       s = s.replaceAll(" ", "").trim();
+                       String[] part = s.split(",");
+                       if (part.length == 3) {
+                               String name = part[0];
+                               String version = part[1];
+                               String arch = part[2];
+                               Package pkg = packageHash.get(name);
+                               if (pkg == null) {
+                                       packageHash.put(name, new Package(name, version, "",
+                                                       arch));
+                               } else {
+                                       pkg.setInstalledVersion(version);
                                }
                        }
-               } catch (Exception e) {
-                       // do nothing
-               }       
-               
+               }
+
                Enumeration<Package> e = packageHash.elements();
-               while(e.hasMoreElements()) {
+               while (e.hasMoreElements()) {
                        packageList.add(e.nextElement());
                }
-               
+
                return packageList;
        }
-       
-       
+
        public static void resetRepositoryForRootstrap(String path) {
-               String cmd = String.format("%s", getRepoResetCmd());            
+               String cmd = String.format("%s", getRepoResetCmd());
                String command = getChrootedCommand(path, cmd);
-               
-               try {
-                       CommandLauncher.executeSudoOutput(command);
 
-               } catch (Exception e) {
-                       // do nothing
-               }
+               executeSudoOutputCommand(command);
        }
 
-       
-       public static Hashtable<String, String> getRepositoryListForDevice(IDevice device) {
+       public static Hashtable<String, String> getRepositoryListForDevice(
+                       IDevice device) {
                PackageManagerOuputReceiver rec = getNewOuputReceiver();
                Hashtable<String, String> reposHash = new Hashtable<String, String>();
-               
-               try {                   
-                       String command = String.format("%s;%s", getResetDbCmd(), getRepoListCmd());
-                       rec.cleanLog();
-                       device.executeShellCommand(command, rec, MAX_TIMEOUT);
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }               
-               
+
+               String command = String.format("%s;%s", getResetDbCmd(),
+                               getRepoListCmd());
+               rec.cleanLog();
+               executeDeviceShellCommand(device, command, rec);
+
                for (String reposStr : rec.getLog()) {
                        reposStr = reposStr.replaceAll(" ", "");
                        String[] part = reposStr.split("\\|");
-                       if ( part.length == 6 && !part[0].equals("#") ) {
+                       if (part.length == 6 && !part[0].equals("#")) {
                                reposHash.put(part[1], part[5]);
                        }
                }
-               
-               return reposHash;               
+
+               return reposHash;
        }
-       
 
        public static String refreshRepositoryForRootstrap(String path) {
-               
-               String result = "";             
-               String cmd = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getRefreshCmd());                                
+
+               String result = "";
+               String cmd = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(),
+                               getRefreshCmd());
                String command = getChrootedCommand(path, cmd);
-               
-       try {
-                       CommandLauncher.executeSudo(command, null, "Platform Internal", null);          
-               } catch (Exception e) {
+
+               try {
+                       CommandLauncher.executeSudo(command, null, "Platform Internal", null);
+               } catch (InterruptedException e) {
                        e.printStackTrace();
-               }               
-                               
+               }
+
                return result;
        }
-       
-       
+
        public static void refreshRepositoryForDevice(IDevice device) {
-               try {                   
-                       PackageManagerOuputReceiver rec = getNewOuputReceiver();
-                       String command = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getRefreshCmd());
-                       rec.cleanLog();
-                       device.executeShellCommand(command, rec, MAX_TIMEOUT);
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }               
+               PackageManagerOuputReceiver rec = getNewOuputReceiver();
+               String command = String.format("%s;%s;%s", getProxyCmd(),
+                               getResetDbCmd(), getRefreshCmd());
+               rec.cleanLog();
+               executeDeviceShellCommand(device, command, rec);
        }
 
-       
-       public static String addRepositoryForRootstrap(String name, String uri, String path) {
-               
+       public static String addRepositoryForRootstrap(String name, String uri,
+                       String path) {
+
                String result = "";
-               String cmd = String.format("%s;%s", getResetDbCmd(), getAddRepoCmd(uri, name));         
+               String cmd = String.format("%s;%s", getResetDbCmd(),
+                               getAddRepoCmd(uri, name));
                String command = getChrootedCommand(path, cmd);
-               
-       try {
-                       result = CommandLauncher.executeSudoOutput(command);
-               
-               } catch (Exception e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }       
-                               
+
+               result = executeSudoOutputCommand(command);
+
                return result;
        }
-       
-       
-       public static void addRepositoryForDevice(String name, String uri, IDevice device) {
-               try {                   
-                       PackageManagerOuputReceiver rec = getNewOuputReceiver();
-                       String command = String.format("%s;%s", getResetDbCmd(), getAddRepoCmd(uri, name));
-                       rec.cleanLog();
-                       device.executeShellCommand(command, rec, MAX_TIMEOUT);
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }               
+
+       public static void addRepositoryForDevice(String name, String uri,
+                       IDevice device) {
+               PackageManagerOuputReceiver rec = getNewOuputReceiver();
+               String command = String.format("%s;%s", getResetDbCmd(),
+                               getAddRepoCmd(uri, name));
+               rec.cleanLog();
+               executeDeviceShellCommand(device, command, rec);
        }
 
-       
        public static String removeRepositoryForRootstrap(String name, String path) {
-               
-               String result = "";             
-               String cmd = String.format("%s;%s", getResetDbCmd(), getRemoveRepoCmd(name));           
+
+               String cmd = String.format("%s;%s", getResetDbCmd(),
+                               getRemoveRepoCmd(name));
                String command = getChrootedCommand(path, cmd);
-               
-       try {
-                       result = CommandLauncher.executeSudoOutput(command);
-               
-               } catch (Exception e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }       
-                               
-               return result;
+
+               return executeSudoOutputCommand(command);
        }
-       
-       
+
        public static void removeRepositoryForDevice(String name, IDevice device) {
-               
-               try {                   
-                       PackageManagerOuputReceiver rec = getNewOuputReceiver();
-                       String command = String.format("%s;%s", getResetDbCmd(), getRemoveRepoCmd(name));
-                       rec.cleanLog();
-                       device.executeShellCommand(command, rec, MAX_TIMEOUT);
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }               
+
+               PackageManagerOuputReceiver rec = getNewOuputReceiver();
+               String command = String.format("%s;%s", getResetDbCmd(),
+                               getRemoveRepoCmd(name));
+               rec.cleanLog();
+               executeDeviceShellCommand(device, command, rec);
        }
-       
-       
-       
-       
-       public static void installRemotePkgForRootstrap(CopyOnWriteArrayList<Package> selectedList, 
-                       String path, IProgressMonitor monitor ) throws InterruptedException {           
+
+       public static void installRemotePkgForRootstrap(
+                       CopyOnWriteArrayList<Package> selectedList, String path,
+                       IProgressMonitor monitor) throws InterruptedException {
 
                actionBeforeUseZypper(path);
-               
-               String cmd = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getInstallPkgCmd(selectedList)); 
+
+               String cmd = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(),
+                               getInstallPkgCmd(selectedList));
                String command = getChrootedCommand(path, cmd);
-               
-               CommandLauncher.executeSudo(command, null, "Platform Internal", monitor);               
+
+               CommandLauncher
+                               .executeSudo(command, null, "Platform Internal", monitor);
        }
-       
-       
-       public static void installRemotePkgForDevice(CopyOnWriteArrayList<Package> selectedList, IDevice device) {
-               
-               try {                   
-                       PackageManagerOuputReceiver rec = getNewOuputReceiver();
-                       String command = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getInstallPkgCmd(selectedList));
-                       rec.cleanLog();
-                       device.executeShellCommand(command, rec, MAX_TIMEOUT);
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }               
+
+       public static void installRemotePkgForDevice(
+                       CopyOnWriteArrayList<Package> selectedList, IDevice device) {
+
+               PackageManagerOuputReceiver rec = getNewOuputReceiver();
+               String command = String.format("%s;%s;%s", getProxyCmd(),
+                               getResetDbCmd(), getInstallPkgCmd(selectedList));
+               rec.cleanLog();
+               executeDeviceShellCommand(device, command, rec);
        }
-       
-       
-       private static void changeUpdateModeForDevice(IDevice device, PackageManagerOuputReceiver rec) {                
-               
-               try {                   
-                       String command = resources.getString("Command.Change.Updatemode");
-                       rec.cleanLog();
-                       device.executeShellCommand(command, rec, MAX_TIMEOUT);
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }                       
+
+       private static void changeUpdateModeForDevice(IDevice device,
+                       PackageManagerOuputReceiver rec) {
+
+               String command = resources.getString("Command.Change.Updatemode");
+               rec.cleanLog();
+               executeDeviceShellCommand(device, command, rec);
        }
-       
-       
+
        private static void actionBeforeUseZypper(String path) {
                if (pkgInstalledSuccessfullyForRootstrap(REMOVE_PKGS, path)) {
                        UninstallPkgFromRootstrapNoDeps(REMOVE_PKGS, path);
                }
        }
 
-       
        private static void actionBeforeUseZypperDevice(IDevice device) {
-               if ( device.isEmulator() ) {
-                       try {                   
-                               PackageManagerOuputReceiver rec = getNewOuputReceiver();
-                               rec.cleanLog();
-                               String command = String.format("sed -i \"s/# arch = s390/arch = i686/g\" /etc/zypp/zypp.conf");
-                               device.executeShellCommand(command, rec, MAX_TIMEOUT);
-                               return;
-                       } catch (Exception e) {
-                               e.printStackTrace();
-                       }
+               if (device.isEmulator()) {
+                       PackageManagerOuputReceiver rec = getNewOuputReceiver();
+                       rec.cleanLog();
+                       String command = String
+                                       .format("sed -i \"s/# arch = s390/arch = i686/g\" /etc/zypp/zypp.conf");
+                       executeDeviceShellCommand(device, command, rec);
                }
        }
 
-       
        private static String getProxyCmd() {
-               return String.format(resources.getString("Command.Export.Proxy"), http_proxy);
+               return String.format(resources.getString("Command.Export.Proxy"),
+                               http_proxy);
        }
-       
-       
+
        private static String getResetDbCmd() {
                return String.format(resources.getString("Command.Reset.Db"));
        }
-       
-       
+
        private static String getDistUpgradeCmd() {
                return String.format(resources.getString("Command.DistUpgrade"));
        }
-       
-       
+
        private static String getInstallPkgCmd(CopyOnWriteArrayList<Package> pkgList) {
                String pkgListStr = "";
-               for( Package pkg: pkgList) {
-                       pkgListStr = pkgListStr.isEmpty() ? pkg.getName() : pkgListStr + " " + pkg.getName();
+               for (Package pkg : pkgList) {
+                       pkgListStr = pkgListStr.isEmpty() ? pkg.getName() : pkgListStr
+                                       + " " + pkg.getName();
                }
-               return String.format(resources.getString("Command.Install.Remote.Pkg"), pkgListStr);
+               return String.format(resources.getString("Command.Install.Remote.Pkg"),
+                               pkgListStr);
        }
 
        private static String getInstallLocalPkgCmd(ArrayList<String> fileList) {
                String pkgListStr = "";
-               for( String filePath: fileList) {
-                       pkgListStr = pkgListStr.isEmpty() ? filePath : pkgListStr + " " + filePath;
+               for (String filePath : fileList) {
+                       pkgListStr = pkgListStr.isEmpty() ? filePath : pkgListStr + " "
+                                       + filePath;
                }
-               return String.format(resources.getString("Command.Install.Local.Pkg"), pkgListStr);
+               return String.format(resources.getString("Command.Install.Local.Pkg"),
+                               pkgListStr);
        }
 
-       private static String getInstallLocalPkgCmdWithRPM(ArrayList<String> fileList) {
+       private static String getInstallLocalPkgCmdWithRPM(
+                       ArrayList<String> fileList) {
                String pkgListStr = "";
-               for( String filePath: fileList) {
-                       pkgListStr = pkgListStr.isEmpty() ? filePath : pkgListStr + " " + filePath;
+               for (String filePath : fileList) {
+                       pkgListStr = pkgListStr.isEmpty() ? filePath : pkgListStr + " "
+                                       + filePath;
                }
-               return String.format(resources.getString("Command.Install.Local.Pkg.RPM"), pkgListStr);
+               return String.format(
+                               resources.getString("Command.Install.Local.Pkg.RPM"),
+                               pkgListStr);
        }
 
-       private static String getUninstallPkgCmd(CopyOnWriteArrayList<Package> pkgList) {
+       private static String getUninstallPkgCmd(
+                       CopyOnWriteArrayList<Package> pkgList) {
                String pkgListStr = "";
-               for( Package pkg: pkgList) {
-                       pkgListStr = pkgListStr.isEmpty() ? pkg.getName() : pkgListStr + " " + pkg.getName();
+               for (Package pkg : pkgList) {
+                       pkgListStr = pkgListStr.isEmpty() ? pkg.getName() : pkgListStr
+                                       + " " + pkg.getName();
                }
-               return String.format(resources.getString("Command.Uninstall.Pkg"), pkgListStr);
+               return String.format(resources.getString("Command.Uninstall.Pkg"),
+                               pkgListStr);
        }
 
        private static String getUninstallPkgCmdNoDeps(String pkgList) {
-               return String.format(resources.getString("Command.Uninstall.Pkg.NoDeps"), pkgList);
+               return String.format(
+                               resources.getString("Command.Uninstall.Pkg.NoDeps"), pkgList);
        }
-       
+
        private static String getRemoveRepoCmd(String name) {
                return String.format(resources.getString("Command.Remove.Repo"), name);
        }
-       
+
        private static String getAddRepoCmd(String uri, String name) {
-               return String.format(resources.getString("Command.Add.Repo"), uri, name);
+               return String
+                               .format(resources.getString("Command.Add.Repo"), uri, name);
        }
-       
+
        private static String getRefreshCmd() {
                return resources.getString("Command.Refresh.Repo");
        }
-       
+
        private static String getRepoListCmd() {
                return resources.getString("Command.List.Repo");
        }
@@ -770,11 +770,11 @@ public class RPMPackageCommander {
        private static String getRemotePkgListCmd() {
                return resources.getString("Command.List.Remote.Pkg");
        }
-       
+
        private static String getInstalledPkgListCmd() {
                return resources.getString("Command.List.Installed.Pkg");
        }
-       
+
        private static String getInstalledPkgListCmdDevice() {
                return resources.getString("Command.List.Installed.Pkg.Device");
        }
@@ -782,119 +782,121 @@ public class RPMPackageCommander {
        private static String getShowPkgCmd(String name) {
                return String.format(resources.getString("Command.Show.Pkg"), name);
        }
-       
+
        private static String getShowPkgInfoCmd(String name) {
-               return String.format(resources.getString("Command.Show.Info.Pkg"), name);
+               return String
+                               .format(resources.getString("Command.Show.Info.Pkg"), name);
        }
-       
+
        private static String getQueryInfoCmd(String tag, String name) {
-               return String.format(resources.getString("Command.Info.Pkg.File"), tag, name);
+               return String.format(resources.getString("Command.Info.Pkg.File"), tag,
+                               name);
        }
-       
-       private static String getInstallPkgWithZypper(String basicOp, String additionOp, String pkgs) {
-               return String.format(resources.getString("Command.Install.Pkg.WithZypper"), 
-                               basicOp, additionOp, pkgs);
+
+       private static String getInstallPkgWithZypper(String basicOp,
+                       String additionOp, String pkgs) {
+               return String.format(
+                               resources.getString("Command.Install.Pkg.WithZypper"), basicOp,
+                               additionOp, pkgs);
        }
-       
+
        private static String getChrootedCommand(String path, String cmd) {
-               return String.format("sudo -S chroot %s sh -c \\\"%s\\\"", path, cmd);          
+               return String.format("sudo -S chroot %s sh -c \\\"%s\\\"", path, cmd);
        }
-       
-       
+
        public static int compareVersion(String ver1, String ver2) {
                ArrayList<String> tokList1 = tokenizeVersionString(ver1);
                ArrayList<String> tokList2 = tokenizeVersionString(ver2);
-               int maxTokens = tokList1.size() > tokList2.size() ? tokList1.size() : tokList2.size();
-               
-               for( int i = 0; i < maxTokens; i++ ) {
+               int maxTokens = tokList1.size() > tokList2.size() ? tokList1.size()
+                               : tokList2.size();
+
+               for (int i = 0; i < maxTokens; i++) {
                        // check length
-                       if ( i == tokList1.size() ) {return -1;}
-                       if ( i == tokList2.size() ) {return 1;}
-                       
-                       String tok1 = tokList1.get(i); 
+                       if (i == tokList1.size()) {
+                               return -1;
+                       }
+                       if (i == tokList2.size()) {
+                               return 1;
+                       }
+
+                       String tok1 = tokList1.get(i);
                        String tok2 = tokList2.get(i);
-                       
+
                        int value1 = -1, value2 = -1;
                        try {
                                value1 = Integer.parseInt(tok1);
-                       }
-                       catch ( NumberFormatException e) {
+                       } catch (NumberFormatException e) {
                                // do nothing
+                               e.printStackTrace();
                        }
-                       
+
                        try {
                                value2 = Integer.parseInt(tok2);
-                       }
-                       catch ( NumberFormatException e) {
+                       } catch (NumberFormatException e) {
                                // do nothing
+                               e.printStackTrace();
                        }
-                       
-                       if ( value1 > value2 ) {
+
+                       if (value1 > value2) {
                                return 1;
-                       }
-                       else if ( value1 < value2 ) {
+                       } else if (value1 < value2) {
                                return -1;
-                       }
-                       else {
+                       } else {
                                int result = tok1.compareTo(tok2);
-                               if ( result != 0 ) {
+                               if (result != 0) {
                                        return result;
                                }
                        }
                }
-               
+
                return 0;
        }
-       
+
        private static ArrayList<String> tokenizeVersionString(String ver) {
                ArrayList<String> result = new ArrayList<String>();
                final int NUM = 0;
                final int ALPHA = 1;
                final int NONALPHANUM = 2;
-               int oldStatus=NONALPHANUM;
+               int oldStatus = NONALPHANUM;
                String buf = "";
-               for( int i = 0; i < ver.length(); i++ ) {
+               for (int i = 0; i < ver.length(); i++) {
                        char c = ver.charAt(i);
                        int newStatus;
-                       if ( c >= '0' && c <= '9' ) {
+                       if (c >= '0' && c <= '9') {
                                newStatus = NUM;
-                       }
-                       else if ( (c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z') ) {
+                       } else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
                                newStatus = ALPHA;
-                       }
-                       else {
+                       } else {
                                newStatus = NONALPHANUM;
                        }
-                       
-                       if ( oldStatus != newStatus ) {
-                               if ( !buf.isEmpty() ) {
+
+                       if (oldStatus != newStatus) {
+                               if (!buf.isEmpty()) {
                                        result.add(buf);
                                }
-                               if ( newStatus != NONALPHANUM ) {
+                               if (newStatus != NONALPHANUM) {
                                        buf = String.valueOf(c);
-                               }
-                               else {
+                               } else {
                                        buf = "";
                                }
                                oldStatus = newStatus;
-                       }
-                       else {
-                               if ( newStatus != NONALPHANUM ) {
+                       } else {
+                               if (newStatus != NONALPHANUM) {
                                        buf += String.valueOf(c);
                                }
                        }
                }
-               if ( !buf.isEmpty() ) {
+               if (!buf.isEmpty()) {
                        result.add(buf);
                }
-               
+
                return result;
        }
-       
+
        static private PackageManagerOuputReceiver getNewOuputReceiver() {
                ConsoleManager cm = new ConsoleManager("Platform Internal", true);
                cm.clear();
-               //MessageConsoleStream mcsError = cm.getMessageConsoleStream();
+               // MessageConsoleStream mcsError = cm.getMessageConsoleStream();
                MessageConsoleStream mcs = cm.getMessageConsoleStream();
                PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver();
                rec.setMessageConsoleStream(mcs);
index f328e0d..2ad9263 100644 (file)
@@ -35,9 +35,6 @@ public enum PackageProvider {
                                else if ( !remove && !pkg.getNewVersion().isEmpty() ) {
                                        selectedList.add(pkg);
                                }
-                               else {
-                                       // do nothing
-                               }
                        }
                }
                
@@ -61,9 +58,6 @@ public enum PackageProvider {
                                else if ( !remove && !pkg.getNewVersion().isEmpty() ) {
                                        selectedList.add(pkg);
                                }
-                               else {
-                                       // do nothing
-                               }
                        }
                }
                
index 8ef4dc5..4af7838 100644 (file)
@@ -249,6 +249,8 @@ public class AddRemotePackageDialog extends Dialog {
                                                                result = entry_2.getInstallInfo().toString().compareTo(entry_1.getInstallInfo().toString());
                                                        }
                                                        break;
+                                               default:
+                                                       break;
                                        }                                       
                                        
                                        return result;
index f182d00..5a90a90 100644 (file)
@@ -127,10 +127,14 @@ public class BuildSystemTab extends CommonTab {
                                        monitor.done();                                                         
                                }
                        });
-               } catch (Exception e1) {
+               } catch (InvocationTargetException e) {
                DialogUtil.openErrorDialog(
-                       resources.getString("PkgMgr.Msg.Error.RefreshFailed")+
-                       "("+e1.toString()+")");
+                       resources.getString("PkgMgr.Msg.Error.RefreshFailed")+
+                       "("+e.toString()+")");
+               } catch (InterruptedException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.RefreshFailed")+
+                       "("+e.toString()+")");
                }
        }
 
@@ -149,11 +153,15 @@ public class BuildSystemTab extends CommonTab {
                                                monitor.done();                                                         
                                }
                        });
-               } catch (Exception e1) {
+               } catch (InvocationTargetException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.UpgradeFailed")+
+                       "("+e.toString()+")");
+               } catch (InterruptedException e) {
                DialogUtil.openErrorDialog(
                        resources.getString("PkgMgr.Msg.Error.UpgradeFailed")+
-                       "("+e1.toString()+")");
-               }                       
+                       "("+e.toString()+")");
+               }
        }
        
        
@@ -178,11 +186,14 @@ public class BuildSystemTab extends CommonTab {
                                        monitor.done();
                                }
                        });
-               }
-               catch (Exception e1) {
+               } catch (InvocationTargetException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.InstallFailed")+
+                       "("+e.toString()+")");
+               } catch (InterruptedException e) {
                DialogUtil.openErrorDialog(
                        resources.getString("PkgMgr.Msg.Error.InstallFailed")+
-                       "("+e1.toString()+")");
+                       "("+e.toString()+")");
                }
        }
        
@@ -201,10 +212,14 @@ public class BuildSystemTab extends CommonTab {
                                        monitor.done();
                                }
                        });
-               } catch (Exception e1) {
+               } catch (InvocationTargetException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.InstallFailed")+
+                       "("+e.toString()+")");
+               } catch (InterruptedException e) {
                DialogUtil.openErrorDialog(
                        resources.getString("PkgMgr.Msg.Error.InstallFailed")+
-                       "("+e1.toString()+")");
+                       "("+e.toString()+")");
                }
        }
        
@@ -229,10 +244,14 @@ public class BuildSystemTab extends CommonTab {
                                                monitor.done();
                                }
                        });
-               } catch (Exception e1) {
+               } catch (InvocationTargetException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.UninstallFailed")+
+                       "("+e.toString()+")");
+               } catch (InterruptedException e) {
                DialogUtil.openErrorDialog(
                        resources.getString("PkgMgr.Msg.Error.UninstallFailed")+
-                       "("+e1.toString()+")");
+                       "("+e.toString()+")");
                }
        }
 
index b17ccdf..14244c7 100644 (file)
@@ -120,10 +120,14 @@ public class DeviceTab extends CommonTab{
                                        monitor.done();                                                         
                                }
                        });
-               } catch (Exception e1) {
+               } catch (InvocationTargetException e) {
                DialogUtil.openErrorDialog(
-                       resources.getString("PkgMgr.Msg.Error.RefreshFailed")+
-                       "("+e1.toString()+")");
+                       resources.getString("PkgMgr.Msg.Error.RefreshFailed")+
+                       "("+e.toString()+")");
+               } catch (InterruptedException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.RefreshFailed")+
+                       "("+e.toString()+")");
                }
        }
        
@@ -153,11 +157,14 @@ public class DeviceTab extends CommonTab{
                                        monitor.done();
                                }
                        });
-               }
-               catch (Exception e1) {
+               } catch (InvocationTargetException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.InstallFailed")+
+                       "("+e.toString()+")");
+               } catch (InterruptedException e) {
                DialogUtil.openErrorDialog(
                        resources.getString("PkgMgr.Msg.Error.InstallFailed")+
-                       "("+e1.toString()+")");
+                       "("+e.toString()+")");
                }
        }
        
@@ -176,10 +183,14 @@ public class DeviceTab extends CommonTab{
                                        monitor.done();
                                }
                        });
-               } catch (Exception e1) {
+               } catch (InvocationTargetException e) {
                DialogUtil.openErrorDialog(
                        resources.getString("PkgMgr.Msg.Error.InstallFailed")+
-                       "("+e1.toString()+")");
+                       "("+e.toString()+")");
+               } catch (InterruptedException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.InstallFailed")+
+                       "("+e.toString()+")");
                }
        }
        
@@ -204,10 +215,14 @@ public class DeviceTab extends CommonTab{
                                                monitor.done();
                                }
                        });
-               } catch (Exception e1) {
+               } catch (InvocationTargetException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.UninstallFailed")+
+                       "("+e.toString()+")");
+               } catch (InterruptedException e) {
                DialogUtil.openErrorDialog(
                        resources.getString("PkgMgr.Msg.Error.UninstallFailed")+
-                       "("+e1.toString()+")");
+                       "("+e.toString()+")");
                }
        }
 
index 143f62e..2eb1a6a 100644 (file)
@@ -78,6 +78,8 @@ public class PackageTableSelectionAdapter extends SelectionAdapter {
                                                        result = entry_2.getInstallInfo().toString().compareTo(entry_1.getInstallInfo().toString());
                                                }
                                                break;                                          
+                                       default:
+                                               break;
                                }                                       
                                
                                return result;
index c114b50..7606964 100644 (file)
@@ -28,6 +28,7 @@
 */
 package org.tizen.nativeplatform.pkgmgr.ui;
 
+import java.io.IOException;
 import java.util.ResourceBundle;
 
 import org.eclipse.core.runtime.FileLocator;
@@ -118,10 +119,11 @@ public class RPMPackageDialog extends Dialog {
        
 
        private void setImage(Shell parentShell) {
+               Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
                try {
-                       Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
                        parentShell.setImage(new Image(Display.getCurrent(), FileLocator.toFileURL(bundle.getEntry("icons/package_installer.gif")).getPath()));
-               } catch (Exception e) {
+               } catch (IOException e) {
+                       e.printStackTrace();
                }
        }
        
index 0a8f3c2..73a310c 100644 (file)
@@ -219,34 +219,35 @@ public class RemoveInstalledPackageDialog extends Dialog {
 
                        ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
 
-                       try {
-                               dialog.run(true, true, new IRunnableWithProgress() {
-                                       @Override
-                                       public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                                       InterruptedException {
+                               try {
+                                       dialog.run(true, true, new IRunnableWithProgress() {
+                                               @Override
+                                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                                               InterruptedException {
+
+                                                       String list = "";                                               
+                                                       for( Package pkg: pkgList) {
+                                                               list = list.concat(pkg.getName() + " ");
+                                                       }
 
-                                               String list = "";                                               
-                                               for( Package pkg: pkgList) {
-                                                       list = list.concat(pkg.getName() + " ");
-                                               }
-                       
-                               
-                                               monitor.beginTask(resources.getString("UninstallPkg.Message.Uninstalling.Package") + 
-                                                               "   " + list, -1);                      
+
+                                                       monitor.beginTask(resources.getString("UninstallPkg.Message.Uninstalling.Package") + 
+                                                                       "   " + list, -1);                      
 
                                                        //RPMPackageCommander.uninstallPkgFromRootstrap(list, rootstrapPath);
-                                                       
-                                               DialogUtil.openMessageDialog(getShell(), 
-                                                               resources.getString("UninstallPkg.Uninstall.Success.Title"), 
-                                                               list.replaceAll(" ", "\n"));
-                                               monitor.beginTask(resources.getString("UninstallPkg.Message.Refreshing.Table"), -1);
-                                               afterUninstallPkgs(pkgList);
-                                       }
-                               });                             
-                                                                       
-                               } catch (Exception e1) {
+                                                               
+                                                       DialogUtil.openMessageDialog(getShell(), 
+                                                                       resources.getString("UninstallPkg.Uninstall.Success.Title"), 
+                                                                       list.replaceAll(" ", "\n"));
+                                                       monitor.beginTask(resources.getString("UninstallPkg.Message.Refreshing.Table"), -1);
+                                                       afterUninstallPkgs(pkgList);
+                                               }
+                                       });
+                               } catch (InvocationTargetException e1) {
+                                       e1.printStackTrace();
+                               } catch (InterruptedException e1) {
                                        e1.printStackTrace();
-                               }
+                               }                               
                        
                        refreshTable();
                }
@@ -345,13 +346,15 @@ public class RemoveInstalledPackageDialog extends Dialog {
                                        InstalledPackage entry_2 = (InstalledPackage)e2;
                                        
                                        switch (selectedColumn) {
-                                               case 0:                                                                 
+                                               case 0:                                         
                                                        if (packageViewer.getTable().getSortDirection() == SWT.DOWN) {
                                                                result = entry_1.getName().compareTo(entry_2.getName());
                                                        } else {
                                                                result = entry_2.getName().compareTo(entry_1.getName());
                                                        }
-                                                       break;                                          
+                                                       break;
+                                               default:
+                                                       break;
                                        }                                       
                                        
                                        return result;
@@ -387,6 +390,8 @@ public class RemoveInstalledPackageDialog extends Dialog {
                                                                result = entry_2.getName().compareTo(entry_1.getName());
                                                        }
                                                        break;                                          
+                                               default:
+                                                       break;
                                        }                                       
                                        
                                        return result;
index 0b030c0..0fab9f4 100644 (file)
@@ -48,6 +48,8 @@ public class RepoTableSelectionAdapter extends SelectionAdapter {
                                                        result = entry_2.getUri().compareTo(entry_1.getUri());
                                                }
                                                break;                                          
+                                       default:
+                                               break;
                                }                                       
                                
                                return result;
index 2638c1b..d6076fb 100644 (file)
@@ -428,9 +428,6 @@ public class PreferencesManager {
                else if ( prevActiveId > id ) {
                        setActiveSiteConfiguration( id - 1 );
                }
-               else {
-                       // do nothing
-               }
        }
        
        
index e74e82d..fa68fd4 100644 (file)
@@ -93,6 +93,7 @@ public class RootstrapManager {
                        SBIModel.reinitialize();
                } catch (SBIException e) {
                        // nothing to do
+                       e.printStackTrace();
                }
                RootstrapManager.notifyChangedRootstrap();
 
@@ -108,6 +109,7 @@ public class RootstrapManager {
                        reinitialize();
                } catch (SBIException e) {
                        // nothing to do
+                       e.printStackTrace();
                }
                RootstrapManager.notifyChangedRootstrap();
        }
@@ -123,11 +125,13 @@ public class RootstrapManager {
                                removeBaseFileSystem( rootstrap.getId() , rootstrap.getArch());
                        } catch (InterruptedException e) {
                                // nothing to do
+                               e.printStackTrace();
                        }
                        try {
                                SBIModel.reinitialize();
                        } catch (SBIException e) {
                                // nothing to do
+                               e.printStackTrace();
                        }
                        RootstrapManager.notifyChangedRootstrap();
                        return true;
@@ -226,7 +230,11 @@ public class RootstrapManager {
                        CommandLauncher.execute( String.format("cp %s %s", pluginFilePath, pluginPath));
                        
                        // reload
-                       SBIModel.reinitialize();
+                       try {
+                               SBIModel.reinitialize();
+                       } catch (SBIException e) {
+                               throw new InterruptedException("SBIModel initialization failed!");
+                       }
                        result = createRootstrapFromSBIPlugin( pluginId );
                        if ( result == null ) {
                                throw new InterruptedException("Loading SBI plugin failed!");
@@ -241,9 +249,6 @@ public class RootstrapManager {
                        else if ( new File(rootstrapPath).exists() ) {
                                CommandLauncher.executeSudo( String.format("sudo -S rm -rf %s", rootstrapPath), null );
                        }
-                       else {
-                               // nothing to do
-                       }
                        
                        if ( !CommandLauncher.executeSudo( String.format("sudo -S tar xvf %s/rootstrap.tar.gz",
                                        tempDirPath), baseDirDir.getPath(), "Platform Internal", monitor ) )  {
@@ -252,7 +257,7 @@ public class RootstrapManager {
                        
                        return result;
                } 
-               catch (Exception e) {
+               catch (InterruptedException e) {
                        if ( pluginPath != null ) {
                                CommandLauncher.execute( String.format("rm -rf %s", pluginPath) );
                                try {
index 91311ce..0f1b545 100644 (file)
@@ -83,6 +83,7 @@ public class CommandLauncher {
                                }
                        } catch (IOException e) {
                                // do nothing
+                               e.printStackTrace();
                        }
                finally{
                        if ( input != null ) tryClose( input );
@@ -319,8 +320,15 @@ public class CommandLauncher {
                        shellScript.setExecutable(true);
 
                        return shellScript.getPath();
-               }
-               catch (Exception e ) {
+               } catch (SecurityException e) {
+                       return null;
+               } catch (NoSuchFieldException e) {
+                       return null;
+               } catch (IllegalArgumentException e) {
+                       return null;
+               } catch (IllegalAccessException e) {
+                       return null;
+               } catch (IOException e ) {
                        return null;
                }
        }
@@ -357,8 +365,15 @@ public class CommandLauncher {
                        interruptScript.setExecutable(true);
                        
                        return interruptScript.getPath();
-               }
-               catch (Exception e ) {
+               } catch (SecurityException e) {
+                       return null;
+               } catch (NoSuchFieldException e) {
+                       return null;
+               } catch (IllegalArgumentException e) {
+                       return null;
+               } catch (IllegalAccessException e) {
+                       return null;
+               } catch (IOException e ) {
                        return null;
                }
        }
@@ -387,7 +402,7 @@ public class CommandLauncher {
                                        process.exitValue();
                                        break;
                                }
-                               catch(Exception e) {
+                               catch(InterruptedException e) {
                                        continue;
                                }
                        }
index 2bd7f5c..ee774db 100644 (file)
@@ -210,12 +210,16 @@ public class AddRootstrapDialog extends Dialog {
                                                    });
                                                        }
                                                }
-                                       });                                     
-                               } catch (Exception e1) {
+                                       });
+                               } catch (InvocationTargetException e1) {
                                        e1.printStackTrace();
                                        DialogUtil.openErrorDialog(e.toString());
                                        return;
-                               } 
+                               } catch (InterruptedException e1) {
+                                       e1.printStackTrace();
+                                       DialogUtil.openErrorDialog(e.toString());
+                                       return;
+                               }                                       
                                
                                archCombo.removeAll();
                                if (snapshotInfos == null || snapshotInfos.size() == 0 ) {
index ef08347..df8bccc 100644 (file)
@@ -473,25 +473,30 @@ public class RootstrapView extends ViewPart {
                
                // generate rootstrap here
                ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
-               try {
-                       dialog.run(true, true, new IRunnableWithProgress() {
-                               @Override
-                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                       InterruptedException {
-                                       monitor.beginTask(resources.getString("GenRootDlg.Progress.Msg.Generating"), -1);
-                                       generatedRootstrap = null;
-                                       generatedRootstrap = RootstrapManager.generate(rootstrapName, arch, repositoryURLs, immediateGen, monitor);
-                                       if ( generatedRootstrap == null ) {
-                                               throw new InterruptedException();
-                                       }
-                               }
-                       });                                     
-               } catch (Exception e1) {
+                       try {
+                               dialog.run(true, true, new IRunnableWithProgress() {
+                                       @Override
+                                       public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                               InterruptedException {
+                                               monitor.beginTask(resources.getString("GenRootDlg.Progress.Msg.Generating"), -1);
+                                               generatedRootstrap = null;
+                                               generatedRootstrap = RootstrapManager.generate(rootstrapName, arch, repositoryURLs, immediateGen, monitor);
+                                               if ( generatedRootstrap == null ) {
+                                                       throw new InterruptedException();
+                                               }
+                                       }
+                               });
+                       } catch (InvocationTargetException e) {
                        DialogUtil.openErrorDialog(String.format("%s\n * %s", 
                                        resources.getString("GenRootDlg.Error.Gen.Rootstrap.Failed"),
-                                       e1.getMessage()));
+                                       e.getMessage()));
                        return;
-               }
+                       } catch (InterruptedException e) {
+                       DialogUtil.openErrorDialog(String.format("%s\n * %s", 
+                                       resources.getString("GenRootDlg.Error.Gen.Rootstrap.Failed"),
+                                       e.getMessage()));
+                       return;
+                       }                                       
 
                RootstrapManager.addRootstrap( generatedRootstrap );
        }
@@ -510,27 +515,27 @@ public class RootstrapView extends ViewPart {
             }
             final String selectedFilePath =  resultFilePath;
                ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
-               try {
-                       dialog.run(true, true, new IRunnableWithProgress() {
-                               @Override
-                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                       try {
+                               dialog.run(true, true, new IRunnableWithProgress() {
+                                       @Override
+                                       public void run(IProgressMonitor monitor) throws InvocationTargetException,
                                                InterruptedException {
-                                       
-                                       monitor.beginTask(resources.getString("Action.Msg.Progress.Importing"), -1);
-                                       generatedRootstrap = null;
-                                       try {
-                                                       generatedRootstrap = RootstrapManager.importRootstrap( selectedFilePath, monitor );
-                                               } catch (Exception e) {
-                                               throw new InterruptedException(e.getMessage());
-                                               }
-                               }
-                       });                                     
-               } catch (Exception e1) {
+                                               
+                                               monitor.beginTask(resources.getString("Action.Msg.Progress.Importing"), -1);
+                                               generatedRootstrap = RootstrapManager.importRootstrap( selectedFilePath, monitor );
+                                       }
+                               });
+                       } catch (InvocationTargetException e) {
                        DialogUtil.openErrorDialog(
                                        String.format("%s\n * %s", resources.getString("Action.Msg.Error.ImportFailed"),
-                                                       e1.getMessage() ) );
+                                                       e.getMessage() ) );
                        return;
-               }
+                       } catch (InterruptedException e) {
+                       DialogUtil.openErrorDialog(
+                                       String.format("%s\n * %s", resources.getString("Action.Msg.Error.ImportFailed"),
+                                                       e.getMessage() ) );
+                       return;
+                       }                                       
         }
         
         if (generatedRootstrap == null) {
@@ -638,24 +643,29 @@ public class RootstrapView extends ViewPart {
                                
                        // generate base file system here if "YES"
                        ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
-                       try {
-                               dialog.run(true, true, new IRunnableWithProgress() {
-                                       @Override
-                                       public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                               InterruptedException {
-                                               monitor.beginTask(resources.getString("GenRootDlg.Progress.Msg.Generating"), -1);
-                                               if( !RootstrapManager.generateBaseFileSystem(selected.getPath().toString(),
-                                                               selected.getArch(), selected.getRepositoryURLs(), monitor) ) {
-                                                       throw new InterruptedException("Generating base file system failed!");
-                                               }
-                                       }
-                               });                                     
-                       } catch (Exception e1) {
+                               try {
+                                               dialog.run(true, true, new IRunnableWithProgress() {
+                                                       @Override
+                                                       public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                                               InterruptedException {
+                                                               monitor.beginTask(resources.getString("GenRootDlg.Progress.Msg.Generating"), -1);
+                                                               if( !RootstrapManager.generateBaseFileSystem(selected.getPath().toString(),
+                                                                               selected.getArch(), selected.getRepositoryURLs(), monitor) ) {
+                                                                       throw new InterruptedException("Generating base file system failed!");
+                                                               }
+                                                       }
+                                               });
+                                       } catch (InvocationTargetException e) {
                                DialogUtil.openErrorDialog(String.format("%s\n * %s", 
                                                resources.getString("GenRootDlg.Error.Gen.Rootstrap.Failed"),
-                                               e1.getMessage()));
+                                               e.getMessage()));
                                return;
-                       }
+                                       } catch (InterruptedException e) {
+                               DialogUtil.openErrorDialog(String.format("%s\n * %s", 
+                                               resources.getString("GenRootDlg.Error.Gen.Rootstrap.Failed"),
+                                               e.getMessage()));
+                               return;
+                                       }                                       
                        
                                        selected.setInitialized(true);
                }
@@ -663,22 +673,27 @@ public class RootstrapView extends ViewPart {
                // launch package manager
                final RPMPackageDialog dlg = new RPMPackageDialog(shell, selected);
                        ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
-                       try {
-                               dialog.run(true, true, new IRunnableWithProgress() {
-                                       @Override
-                                       public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                               InterruptedException {
-                                               
-                                               monitor.beginTask(resources.getString("Action.Msg.Progress.Initializing.PkgMgr"), -1);
-                                               dlg.initializeDialogData(monitor);
-                                       }
-                               });                                     
-                       } catch (Exception e1) {
+                       try {
+                                       dialog.run(true, true, new IRunnableWithProgress() {
+                                               @Override
+                                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                                       InterruptedException {
+                                                       
+                                                       monitor.beginTask(resources.getString("Action.Msg.Progress.Initializing.PkgMgr"), -1);
+                                                       dlg.initializeDialogData(monitor);
+                                               }
+                                       });
+                               } catch (InvocationTargetException e) {
                        DialogUtil.openErrorDialog(     String.format("%s\n * %s\n * %s", 
                                        resources.getString("Action.Msg.Error.InitFailed.PkgMgr"),
-                                       e1.getMessage(), "If no response for long time, check your proxy setting." ) );
+                                       e.getMessage(), "If no response for long time, check your proxy setting." ) );
                        return;
-                       }
+                               } catch (InterruptedException e) {
+                       DialogUtil.openErrorDialog(     String.format("%s\n * %s\n * %s", 
+                                       resources.getString("Action.Msg.Error.InitFailed.PkgMgr"),
+                                       e.getMessage(), "If no response for long time, check your proxy setting." ) );
+                       return;
+                               }                                       
 
                dlg.open();
                
@@ -771,28 +786,33 @@ public class RootstrapView extends ViewPart {
                        if (selectedFilePath != null) {
                                // generate rootstrap here
                                ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
-                               try {
-                                       dialog.run(true, true, new IRunnableWithProgress() {
-                                               @Override
-                                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                                       InterruptedException {
-                                                       
-                                                       monitor.beginTask(resources.getString("Action.Msg.Progress.Exporting"), -1);
-                                                       boolean result = RootstrapManager.exportRootstrap( selectedRootstrap, selectedFilePath, monitor );
-                                                       if ( result ) {
-                                                       DialogUtil.openMessageDialog(shell,resources.getString("Action.Msg.Info.ExportOK"));
-                                                       }
-                                                       else {
-                                                       DialogUtil.openMessageDialog(shell, resources.getString("Action.Msg.Error.ExportFailed"));
-                                                       }
-                                               }
-                                       });                                     
-                               } catch (Exception e1) {
+                               try {
+                                               dialog.run(true, true, new IRunnableWithProgress() {
+                                                       @Override
+                                                       public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                                               InterruptedException {
+                                                               
+                                                               monitor.beginTask(resources.getString("Action.Msg.Progress.Exporting"), -1);
+                                                               boolean result = RootstrapManager.exportRootstrap( selectedRootstrap, selectedFilePath, monitor );
+                                                       if ( result ) {
+                                                               DialogUtil.openMessageDialog(shell,resources.getString("Action.Msg.Info.ExportOK"));
+                                                       }
+                                                       else {
+                                                               DialogUtil.openMessageDialog(shell, resources.getString("Action.Msg.Error.ExportFailed"));
+                                                       }
+                                                       }
+                                               });
+                                       } catch (InvocationTargetException e) {
+                               DialogUtil.openErrorDialog(     String.format("%s\n * %s", 
+                                               resources.getString("Action.Msg.Error.ExportFailed"),
+                                               e.getMessage() ) );
+                               return;
+                                       } catch (InterruptedException e) {
                                DialogUtil.openErrorDialog(     String.format("%s\n * %s", 
                                                resources.getString("Action.Msg.Error.ExportFailed"),
-                                               e1.getMessage() ) );
+                                               e.getMessage() ) );
                                return;
-                               }
+                                       }                                       
                        }
             }
 
@@ -890,6 +910,8 @@ public class RootstrapView extends ViewPart {
                                        return name;                                    
                                case COL_IDX_ARCH:
                                        return getArchitectureCategory(arch);
+                               default:
+                                       break;
                                }
                        }
                        return null;
index 7837085..dbff7e0 100644 (file)
@@ -234,9 +234,6 @@ public class TizenPlatformMainWizardPage extends TizenMainWizardPage {
                                        testedEntryDescriptors.put(ed.getId(), ed2.getId());
                                        ed.setHandler(ed2.getHandler());
                                }
-                               else {
-                                       //break;
-                               }
                                break;
                     }
                 }
index 33949de..c4f0727 100644 (file)
@@ -324,6 +324,8 @@ public class TizenPlatformPWComposite extends PWWidget {
                                } else {
                                        return "";
                                }
+                       default:
+                               break;
                        }
                        return null;
                }