From: jm.jaemin.kim Date: Fri, 4 Jul 2014 08:16:02 +0000 (+0900) Subject: MISC : Fixed prevent error X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F50%2F23850%2F2;p=sdk%2Fide%2Fnativeplatform-eplugin.git MISC : Fixed prevent error major 15 build,command,launch,pkg,pkgmgr,remote and util packages. Change-Id: I6a0400a6da7ad087cc161931eba5749cf920b2f5 Signed-off-by: jm.jaemin.kim --- diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformBuildCommandLauncher.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformBuildCommandLauncher.java index 32e63e5..592c720 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformBuildCommandLauncher.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformBuildCommandLauncher.java @@ -47,6 +47,7 @@ import org.tizen.nativeplatform.Activator; import org.tizen.nativeplatform.remote.connection.RemoteConnectionManager; import org.tizen.nativeplatform.rootstrap.RootstrapManager; import org.tizen.nativeplatform.util.RootstrapUtil; +import org.tizen.nativeplatform.views.model.PlatformRootstrap; import org.tizen.nativeplatform.command.launcher.RemoteCommandUtil; public class PlatformBuildCommandLauncher extends CommandLauncher { @@ -137,7 +138,10 @@ public class PlatformBuildCommandLauncher extends CommandLauncher { IProject proj = getProject(); String targetId = PlatformConfigurationManager.getBuildTargetName(config); String rootId = SmartBuildInterface.getInstance().getRootstrapIDFromTargetID(targetId); - if (RootstrapManager.getRootstrap(rootId).isDefault()) { + + PlatformRootstrap rootstrap = RootstrapManager.getRootstrap(rootId); + + if (rootstrap != null && rootstrap.isDefault()) { Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, "Select user rootstrap", null); throw new CoreException(status); diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformExternalBuildRunner.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformExternalBuildRunner.java index 0a06e1d..2ae8f64 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformExternalBuildRunner.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformExternalBuildRunner.java @@ -144,7 +144,9 @@ public class PlatformExternalBuildRunner extends ExternalBuildRunner { if (needRemoteSync) { checkRemoteConnection(); syncWorkspace(project, configuration, monitor); - readySyncRootstrap(rootstrap); + if (rootstrap != null) { + readySyncRootstrap(rootstrap); + } } UserLogger.start(UserInteraction.CATE_PLATFORM_BUILD); @@ -417,24 +419,24 @@ public class PlatformExternalBuildRunner extends ExternalBuildRunner { if (exitValue == 0) { IBuildResultProcessor processor = PlatformBuildResultProcessorFactory .getProcessor(BUILDTOOL.GBS, configuration); - if (processor.process(buildArguments)) { - String[] rpmFiles = processor.getRpmFiles(); - String[] xmlFiles = processor.getXmlFiles(); - if (rpmFiles.length > 0) { - buf = new StringBuffer(NEWLINE); - buf.append("**** RPM files ****").append(NEWLINE); - for (String file : rpmFiles) { - buf.append(" - ").append(file).append(NEWLINE); - } - } + if (processor != null && processor.process(buildArguments)) { + String[] rpmFiles = processor.getRpmFiles(); + String[] xmlFiles = processor.getXmlFiles(); + if (rpmFiles.length > 0) { + buf = new StringBuffer(NEWLINE); + buf.append("**** RPM files ****").append(NEWLINE); + for (String file : rpmFiles) { + buf.append(" - ").append(file).append(NEWLINE); + } + } if (xmlFiles.length > 0) { - buf.append(NEWLINE); - buf.append("**** XML files ****").append(NEWLINE); - for (String file : xmlFiles) { - buf.append(" - ").append(file).append(NEWLINE); - } + buf.append(NEWLINE); + buf.append("**** XML files ****").append(NEWLINE); + for (String file : xmlFiles) { + buf.append(" - ").append(file).append(NEWLINE); + } } - consoleOut.write(buf.toString().getBytes()); + consoleOut.write(buf.toString().getBytes()); } else { buf = new StringBuffer(NEWLINE); buf.append("**** Failed to synchronize output files ****").append( diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/command/launcher/DeviceChangeListener.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/command/launcher/DeviceChangeListener.java index e742229..b2622a6 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/command/launcher/DeviceChangeListener.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/command/launcher/DeviceChangeListener.java @@ -3,6 +3,7 @@ package org.tizen.nativeplatform.command.launcher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.tizen.common.util.OSChecker; +import org.tizen.nativeplatform.pkg.commander.IPkgCommander; import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget; import org.tizen.nativeplatform.remote.connection.RemoteConnectionManager; import org.tizen.nativeplatform.util.PlatformProjectUtil; @@ -12,7 +13,7 @@ import org.tizen.sdblib.IDeviceChangeListener; import org.tizen.sdblib.util.DeviceUtil; public class DeviceChangeListener implements IDeviceChangeListener { - + protected final Logger logger = LoggerFactory.getLogger(DeviceChangeListener.class); @Override @@ -27,8 +28,10 @@ public class DeviceChangeListener implements IDeviceChangeListener { e.printStackTrace(); logger.error("Faile to root on device", e); } - - target.getDeviceCommander().actionBeforeUsingZypper(); + IPkgCommander pkgCommander = target.getDeviceCommander(); + if (pkgCommander != null) { + pkgCommander.actionBeforeUsingZypper(); + } if (OSChecker.isWindows() && RemoteConnectionManager.connected()) { SSHUtil.transferSshKey(target); } diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/LaunchConfigurationProcessor.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/LaunchConfigurationProcessor.java index 22e380a..86efa89 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/LaunchConfigurationProcessor.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/LaunchConfigurationProcessor.java @@ -88,16 +88,18 @@ public class LaunchConfigurationProcessor implements ILaunchConfigurationProcess killIfRunningApplication(appId); } boolean result = installPackages(configurationIsSet, monitor); - UserLogger.end(UserInteraction.CATE_PLATFORM_LAUNCH, PlatformUserInteraction.PRE_LAUNCH); + UserLogger + .end(UserInteraction.CATE_PLATFORM_LAUNCH, PlatformUserInteraction.PRE_LAUNCH); return result; } else { monitor.beginTask("", 2); try { - String descMsg = ""; + String descMsg = ""; if (!installPackages(configurationIsSet, new SubProgressMonitor(monitor, 1))) { descMsg = "Installation seems to be failed. Check package installation log."; } - UserLogger.end(UserInteraction.CATE_PLATFORM_LAUNCH, PlatformUserInteraction.PRE_LAUNCH); + UserLogger.end(UserInteraction.CATE_PLATFORM_LAUNCH, + PlatformUserInteraction.PRE_LAUNCH); if (!setLaunchConfiguration(new SubProgressMonitor(monitor, 1), descMsg, isEflApp)) { return false; } @@ -107,7 +109,7 @@ public class LaunchConfigurationProcessor implements ILaunchConfigurationProcess } return true; } - + private boolean _installPackages(List devicePkgs, List rootstrapPkgs, boolean reinstallOp, IProgressMonitor monitor) throws CoreException { int totalWorks = 2; @@ -136,13 +138,16 @@ public class LaunchConfigurationProcessor implements ILaunchConfigurationProcess return true; } - + private void setSmackRule() { String[] programPaths = PlatformLaunchUtil.getProgramPath(project); if (programPaths == null || programPaths.length <= 0) { return; } IPkgCommander commander = target.getDeviceCommander(); + if (commander == null) { + return; + } StringBuffer pathlist = new StringBuffer(); for (String path : programPaths) { pathlist.append(path); @@ -159,7 +164,9 @@ public class LaunchConfigurationProcessor implements ILaunchConfigurationProcess if (a_label != null && !a_label.isEmpty()) { commander.executeBinary(getSmackRuleCommand(a_label)); } - commander.setSmackExecute(filepath, "\"\""); + //if (commander != null) { + commander.setSmackExecute(filepath, "\"\""); + //} } } @@ -188,8 +195,8 @@ public class LaunchConfigurationProcessor implements ILaunchConfigurationProcess devicePackages.addAll(maker.makeModels(devicePkgStr)); rootstrapPackages.addAll(maker.makeModels(rootstrapPkgStr)); } else { - List packages = null; - packages = pkgUtil.getPackages(project, buildConfig); + List packages = null; + packages = pkgUtil.getPackages(project, buildConfig); if (packages != null && !packages.isEmpty()) { devicePackages.addAll(pkgFilter.filter(CmdTargetTypes.DEVICE, packages)); rootstrapPackages.addAll(pkgFilter.filter(CmdTargetTypes.ROOTSTRAP, packages)); @@ -205,7 +212,7 @@ public class LaunchConfigurationProcessor implements ILaunchConfigurationProcess private boolean setLaunchConfiguration(IProgressMonitor monitor, final String descMsg, final boolean isEflApp) throws CoreException { - + monitor.beginTask("", 1); final ILaunchConfigurationWorkingCopy wc = launchConfig.getWorkingCopy(); try { @@ -223,14 +230,15 @@ public class LaunchConfigurationProcessor implements ILaunchConfigurationProcess boolean loadSharedLib = dlg.loadSharedLibAutomatically(); applicationId = dlg.getSelectedApp(); Map environments = dlg.getEnvironments(); - setOptionAttributes(wc, programPath, arguments, applicationId, environments, loadSharedLib); + setOptionAttributes(wc, programPath, arguments, applicationId, + environments, loadSharedLib); } } }); } finally { monitor.done(); } - + if (isSetProgramPath(launchConfig)) { if (applicationId != null && !applicationId.isEmpty()) { killIfRunningApplication(applicationId); @@ -240,18 +248,20 @@ public class LaunchConfigurationProcessor implements ILaunchConfigurationProcess return false; } } + /* - protected void setOptionAttributes(ILaunchConfigurationWorkingCopy wc, String programPath, - String arguments, String applicationId, List devicePackages, - List rootstrapPackages, boolean reinstallOp, boolean selectPkgOp, - Map environments) { - setOptionAttributes(wc, programPath, arguments, applicationId, environments); - setOptionAttributes(wc, devicePackages, rootstrapPackages, reinstallOp); - } - */ + * protected void setOptionAttributes(ILaunchConfigurationWorkingCopy wc, + * String programPath, String arguments, String applicationId, + * List devicePackages, List rootstrapPackages, boolean + * reinstallOp, boolean selectPkgOp, Map environments) { + * setOptionAttributes(wc, programPath, arguments, applicationId, + * environments); setOptionAttributes(wc, devicePackages, rootstrapPackages, + * reinstallOp); } + */ protected void setOptionAttributes(ILaunchConfigurationWorkingCopy wc, String programPath, - String arguments, String applicationId, Map environments, boolean loadSharedLib) { + String arguments, String applicationId, Map environments, + boolean loadSharedLib) { if (programPath != null) { wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programPath); } @@ -325,13 +335,14 @@ public class LaunchConfigurationProcessor implements ILaunchConfigurationProcess protected IConfiguration getBuildConfiguration() { return PlatformConfigurationManager.getDefaultConfiguration(project); } - - protected boolean questionIfNoPackagesToInstall(List devicePackages, List rootstrapPackages) { + + protected boolean questionIfNoPackagesToInstall(List devicePackages, + List rootstrapPackages) { final StringBuffer msg = new StringBuffer(); if (devicePackages.isEmpty()) { msg.append("There is no package to install to device."); msg.append("\n"); - } + } if (mode.equals(ILaunchManager.DEBUG_MODE) && rootstrapPackages.isEmpty()) { msg.append("There is no package to install to rootstrap."); msg.append("\n"); diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/PlatformMIProcessAdapter.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/PlatformMIProcessAdapter.java index d2e6744..401dd9d 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/PlatformMIProcessAdapter.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/PlatformMIProcessAdapter.java @@ -158,9 +158,10 @@ public class PlatformMIProcessAdapter extends MIProcessAdapter { try { PushbackInputStream pb = new PushbackInputStream(pgdb.getInputStream()); gdbInputStream = pb; - /* - * gdb process is terminated after execution pb.read() and pb.unread() (on windows) - * It is not entirely clear whether to need push back process. + /* + * gdb process is terminated after execution pb.read() and + * pb.unread() (on windows) It is not entirely clear whether + * to need push back process. */ // pb.unread(pb.read()); } catch (Exception e) { @@ -198,10 +199,14 @@ public class PlatformMIProcessAdapter extends MIProcessAdapter { e.printStackTrace(); } if (monitor.isCanceled()) { - gdbProcess.destroy(); + if (gdbProcess != null) { + gdbProcess.destroy(); + } throw new OperationCanceledException(); } else if (timepass >= launchTimeout) { - gdbProcess.destroy(); + if (gdbProcess != null) { + gdbProcess.destroy(); + } String message = MIPlugin.getResourceString("src.GDBDebugger.Error_launch_timeout"); //$NON-NLS-1$ throw new IOException(message); } diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchCommonPage.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchCommonPage.java index 998c8da..2c15afb 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchCommonPage.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchCommonPage.java @@ -36,8 +36,7 @@ public class PlatformLaunchCommonPage extends WizardPage { protected String rootPath = ""; protected Shell shell; protected IPackageUtil pkgUtil = PkgUtilFactory.getPkgUtil(PlatformProjectUtil.getPkgType()); - protected IPkgFilter pkgFilter = PkgFilterFactory.getFilter(PlatformProjectUtil - .getPkgType()); + protected IPkgFilter pkgFilter = PkgFilterFactory.getFilter(PlatformProjectUtil.getPkgType()); protected PlatformLaunchCommonPage(String pageName) { super(pageName); @@ -71,7 +70,7 @@ public class PlatformLaunchCommonPage extends WizardPage { platformPackages = getPackages(platformProject, config); // Do not try packaging because it is already tried previous step. // (PlatformProjectLaunchShortcut) - if (!platformPackages.isEmpty()) { + if (platformPackages != null && !platformPackages.isEmpty()) { packages.addAll(platformPackages); devicePackages.addAll(pkgFilter.filter(CmdTargetTypes.DEVICE, packages)); rootstrapPackages.addAll(pkgFilter.filter(CmdTargetTypes.ROOTSTRAP, packages)); @@ -81,11 +80,11 @@ public class PlatformLaunchCommonPage extends WizardPage { public List getPackages() { return packages; } - + public List getDevicePackages() { return devicePackages; } - + public List getRootstrapPackages() { return rootstrapPackages; } diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RemoteRpmModelMaker.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RemoteRpmModelMaker.java index b06da8b..c63002c 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RemoteRpmModelMaker.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RemoteRpmModelMaker.java @@ -34,6 +34,7 @@ import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.tizen.common.util.FilenameUtil; +import org.tizen.nativeplatform.pkg.commander.IPkgCommander; import org.tizen.nativeplatform.pkg.commander.IPkgModelMaker; import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget; import org.tizen.nativeplatform.pkg.model.IPackage; @@ -50,18 +51,21 @@ public class RemoteRpmModelMaker implements IPkgModelMaker { public RemoteRpmModelMaker() { target = new PkgCommandTarget(PkgTypes.REMOTERPM); } - + private IPackage _makeModel(String filePath) { RemoteRpmPackage pkg = new RemoteRpmPackage(); - String[] info = target.getCommander(CmdTargetTypes.HOST, false).getInfoFromFile(filePath); - if (info == null) { - logger.error(String.format("Failed to get rpm information: %s", filePath)); - return null; + IPkgCommander pkgCommander = target.getCommander(CmdTargetTypes.HOST, false); + if (pkgCommander != null) { + String[] info = pkgCommander.getInfoFromFile(filePath); + if (info == null) { + logger.error(String.format("Failed to get rpm information: %s", filePath)); + return null; + } + pkg.setPath(filePath); + pkg.setName(info[0]); + pkg.setArch(info[1]); + pkg.setVer(info[2]); } - pkg.setPath(filePath); - pkg.setName(info[0]); - pkg.setArch(info[1]); - pkg.setVer(info[2]); return pkg; } @@ -81,7 +85,7 @@ public class RemoteRpmModelMaker implements IPkgModelMaker { pkg.setNeedsFilter(needsFilter); return pkg; } - + public List makeModels(List filePaths) { List pkgs = new ArrayList(); for (String path : filePaths) { diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmModelMaker.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmModelMaker.java index 55502df..c12f473 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmModelMaker.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmModelMaker.java @@ -33,6 +33,7 @@ import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.tizen.nativeplatform.pkg.commander.IPkgCommander; import org.tizen.nativeplatform.pkg.commander.IPkgModelMaker; import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget; import org.tizen.nativeplatform.pkg.model.IPackage; @@ -53,15 +54,18 @@ public class RpmModelMaker implements IPkgModelMaker { private IPackage _makeModel(String filePath) { RpmPackage pkg = new RpmPackage(); - String[] info = target.getCommander(CmdTargetTypes.HOST, false).getInfoFromFile(filePath); - if (info == null) { - logger.error(String.format("Failed to get rpm information: %s", filePath)); - return null; + IPkgCommander pkgCommander = target.getCommander(CmdTargetTypes.HOST, false); + if (pkgCommander != null) { + String[] info = pkgCommander.getInfoFromFile(filePath); + if (info == null) { + logger.error(String.format("Failed to get rpm information: %s", filePath)); + return null; + } + pkg.setPath(filePath); + pkg.setName(info[0]); + pkg.setArch(info[1]); + pkg.setVer(info[2]); } - pkg.setPath(filePath); - pkg.setName(info[0]); - pkg.setArch(info[1]); - pkg.setVer(info[2]); return pkg; } diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/CommonTab.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/CommonTab.java index f64c504..31ac6c9 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/CommonTab.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/CommonTab.java @@ -289,7 +289,8 @@ abstract public class CommonTab { composite.setLayoutData(gridData); composite.setLayout(new FillLayout()); - repoViewer = new TableViewer(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); + repoViewer = new TableViewer(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL + | SWT.FULL_SELECTION); createColumnsForRepoTable(composite); Table reposTable = repoViewer.getTable(); reposTable.setHeaderVisible(true); @@ -837,6 +838,9 @@ abstract public class CommonTab { if (categoryCombo.getText().equals("Upgradable")) { IPkgVersionComparer comp = PkgVersionComparerFactory .getComparer(PlatformProjectUtil.getPkgType()); + if (comp == null) { + return false; + } if (pkg.getInstalledVer().isEmpty() || pkg.getNewVer().isEmpty() || comp.compare(pkg.getInstalledVer(), pkg.getNewVer()) >= 0) { return false; @@ -1033,7 +1037,7 @@ abstract public class CommonTab { } } - protected void handleRemovePackageButton() { + protected void handleRemovePackageButton() { final List selectedList = getSelectedPkgList(true); if (selectedList.isEmpty()) { DialogUtil.openErrorDialog(resources.getString("PkgMgr.Error.Noselected.Package") diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/remote/connection/RemoteConnectionManager.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/remote/connection/RemoteConnectionManager.java index 16bef97..b46206d 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/remote/connection/RemoteConnectionManager.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/remote/connection/RemoteConnectionManager.java @@ -23,7 +23,7 @@ import org.tizen.nativeplatform.preferences.RemoteServerPreferencesManager; public class RemoteConnectionManager { public static String DEFAULT_CONNECTION_NAME = "remote_connection"; private static Map connectionMap = new HashMap(); - + public static final Logger logger = LoggerFactory.getLogger(RemoteConnectionManager.class); public static boolean createConnection(String host, String user, String pass, String publicKey, @@ -39,7 +39,9 @@ public class RemoteConnectionManager { if (conn == null) { monitor.beginTask("Creating connection...", 2); IRemoteConnectionManager manager = getConnectionManager(); - conn = manager.newConnection(connectionName); + if (manager != null) { + conn = manager.newConnection(connectionName); + } conn.setAddress(host); conn.setUsername(user); conn.setPassword(pass); @@ -135,7 +137,9 @@ public class RemoteConnectionManager { } IRemoteConnectionManager manager = getConnectionManager(); try { - manager.removeConnection(conn); + if (manager != null) { + manager.removeConnection(conn); + } } catch (RemoteConnectionException e) { e.printStackTrace(); } diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/PackageUtil.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/PackageUtil.java index b6315c1..34a1d43 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/PackageUtil.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/PackageUtil.java @@ -96,7 +96,7 @@ public class PackageUtil implements IPackageUtil { throws CoreException { project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor); List pkgs = getPackages(project, config); - if (pkgs.isEmpty()) { + if (pkgs != null && pkgs.isEmpty()) { return false; } return true; @@ -104,9 +104,13 @@ public class PackageUtil implements IPackageUtil { public void cachePkgChecksum(IProject project, IConfiguration config) { try { - if (!CachePackageChecksum.cachePkgChecksum(project, getPackages(project, config))) { - logger.error(PlatformLaunchMessages.FAILED_CACHE_PACKAGE_CHECKSUM); + List newPkgs = getPackages(project, config); + if (newPkgs != null) { + if (!CachePackageChecksum.cachePkgChecksum(project, newPkgs)) { + logger.error(PlatformLaunchMessages.FAILED_CACHE_PACKAGE_CHECKSUM); + } } + } catch (InterruptedException e) { logger.error(PlatformLaunchMessages.FAILED_CACHE_PACKAGE_CHECKSUM); e.printStackTrace(); @@ -127,57 +131,59 @@ public class PackageUtil implements IPackageUtil { } public List getPackages(IProject project, IConfiguration config) { - + List cached = PackageStoreManager.get(project, config); if (cached != null) { return cached; } - + List pkgs = new ArrayList(); IFolder folder = project.getFolder(config.getName()); File dir = new File(folder.getLocation().toOSString()); if (dir.exists()) { String[] files = dir.list(new RpmFileFilter()); for (String file : files) { - IPath pkgPath = new Path(dir.getPath()).append(file); - pkgs.add(pkgPath.toOSString()); + IPath pkgPath = new Path(dir.getPath()).append(file); + pkgs.add(pkgPath.toOSString()); } } - List newPkgs = getPackages(pkgs); - PackageStoreManager.put(project, config, newPkgs); - return newPkgs; + List newPkgs = getPackages(pkgs); + PackageStoreManager.put(project, config, newPkgs); + return newPkgs; } - -public List getPackages(IProject project, IConfiguration config, String selectedRootstrapArch) { - - //TODO: commit jaemin return null if curentArchType(i586 or armv7l) does not exist. - + + public List getPackages(IProject project, IConfiguration config, + String selectedRootstrapArch) { + + // TODO: commit jaemin return null if curentArchType(i586 or armv7l) + // does not exist. + List cached = PackageStoreManager.get(project, config); - + if (cached != null) { - if(cached.get(0).getArch().equals(selectedRootstrapArch)){ - return cached; - }else{ - return null; - } + if (cached.get(0).getArch().equals(selectedRootstrapArch)) { + return cached; + } else { + return null; + } } - + List pkgs = new ArrayList(); IFolder folder = project.getFolder(config.getName()); File dir = new File(folder.getLocation().toOSString()); if (dir.exists()) { String[] files = dir.list(new RpmFileFilter()); for (String file : files) { - if(file.contains(selectedRootstrapArch)){ - IPath pkgPath = new Path(dir.getPath()).append(file); - pkgs.add(pkgPath.toOSString()); - } + if (file.contains(selectedRootstrapArch)) { + IPath pkgPath = new Path(dir.getPath()).append(file); + pkgs.add(pkgPath.toOSString()); + } } } - if(!pkgs.isEmpty()){ - List newPkgs = getPackages(pkgs); - PackageStoreManager.put(project, config, newPkgs); - return newPkgs; + if (!pkgs.isEmpty()) { + List newPkgs = getPackages(pkgs); + PackageStoreManager.put(project, config, newPkgs); + return newPkgs; } return null; } @@ -187,7 +193,7 @@ public List getPackages(IProject project, IConfiguration config, Strin List pkgmodel = modelMaker.makeModels(pkgPath); return pkgmodel; } - + public static List getRemoteRpmFiles(PlatformRootstrap rootstrap) { List rpms = new ArrayList(); String rootstrapPath = RootstrapUtil.getRemoteRootstrapScratchPath(rootstrap.getId());