From e389e255ca26163a281ee78927579d962c9c954a Mon Sep 17 00:00:00 2001 From: Gun Kim Date: Fri, 5 Apr 2013 17:38:59 +0900 Subject: [PATCH] [Title] added to check ".sdk_delta.info" file upload is success or not. [Type] [Module] [Priority] [Jira#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] Change-Id: Ie7af8ac58d3fe4bacdba30b401a947130df21ed7 --- .../src/org/tizen/common/rds/RdsDeltaDetector.java | 13 +++++++++---- .../src/org/tizen/common/rds/RdsDeployer.java | 15 +++++++++------ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/org.tizen.common/src/org/tizen/common/rds/RdsDeltaDetector.java b/org.tizen.common/src/org/tizen/common/rds/RdsDeltaDetector.java index caa3dd8..272afc1 100755 --- a/org.tizen.common/src/org/tizen/common/rds/RdsDeltaDetector.java +++ b/org.tizen.common/src/org/tizen/common/rds/RdsDeltaDetector.java @@ -51,6 +51,7 @@ import org.tizen.common.util.IOUtil; import org.tizen.common.util.log.Logger; import org.tizen.sdblib.IDevice; import org.tizen.sdblib.SyncService; +import org.tizen.sdblib.SyncService.SyncResult; /** * Delta Detector for Rapid Development Support. @@ -79,12 +80,13 @@ public class RdsDeltaDetector { * Reads the STR_TREE_FILE, and sets the oldTree. */ public void readOldTree() { - downloadOldTree(); + String strLocalFile = downloadOldTree(); + if ( strLocalFile == null ) { + return; + } Workspace workspace = ((Workspace)project.getWorkspace()); ElementTreeReader treeReader = new ElementTreeReader(workspace.getSaveManager()); - String strLocalFile = project.getLocation().toString() + "/" + STR_TREE_FILE; - DataInputStream input = null; try { input = new DataInputStream(new SafeFileInputStream(strLocalFile, strLocalFile + ".temp", TREE_BUFFER_SIZE)); @@ -125,7 +127,10 @@ public class RdsDeltaDetector { String deltaFileOnRemote = remotePath + STR_TREE_DIRECTORY + STR_TREE_FILE; strLocalFile = project.getLocation().toString() + "/" + STR_TREE_FILE; try { - device.getSyncService().pullFile(deltaFileOnRemote, strLocalFile, true, SyncService.getNullProgressMonitor()); + SyncResult result = device.getSyncService().pullFile(deltaFileOnRemote, strLocalFile, true, SyncService.getNullProgressMonitor()); + if ( result.getCode() != SyncService.RESULT_OK ) { + throw new Exception(result.getMessage()); + } } catch (Exception e) { return null; } diff --git a/org.tizen.common/src/org/tizen/common/rds/RdsDeployer.java b/org.tizen.common/src/org/tizen/common/rds/RdsDeployer.java index 15a9c7b..65ecf1b 100644 --- a/org.tizen.common/src/org/tizen/common/rds/RdsDeployer.java +++ b/org.tizen.common/src/org/tizen/common/rds/RdsDeployer.java @@ -228,11 +228,7 @@ public abstract class RdsDeployer implements Closeable{ File file = deltaListFile.makeFile(strProjectPath); if ( file != null ) { try { - command = RdsDeployer.makeRdsLog(NLS.bind(RdsMessages.RDS_PUSH_LOG, file.getCanonicalPath(), strAppInstallPath + "/" + file.getName())); - SyncResult result = getSyncService().pushFile(file.getCanonicalPath(), strAppInstallPath + "/" + file.getName(), SyncService.getNullProgressMonitor()); - if ( result.getCode() != SyncService.RESULT_OK ) { - throw new IOException(command); - } + pushFile(file.getCanonicalPath(), strAppInstallPath + "/" + file.getName()); printInfo( command ); } catch (Exception e) { newCoreException(RdsDeployer.makeRdsLog(RdsMessages.RDS_PUSH_ERROR), e); @@ -318,7 +314,7 @@ public abstract class RdsDeployer implements Closeable{ String strRemotePath = appInstallPath + RdsDeltaDetector.STR_TREE_DIRECTORY + RdsDeltaDetector.STR_TREE_FILE; try { - getSyncService().pushFile(strDeltaInfoFile, strRemotePath, SyncService.getNullProgressMonitor()); + pushFile(strDeltaInfoFile, strRemotePath); } catch (Exception e) { Logger.error(RdsDeployer.makeRdsLog(RdsMessages.RDS_RES_INFO_PUSH_ERROR), e); } @@ -328,6 +324,13 @@ public abstract class RdsDeployer implements Closeable{ return RdsMessages.RDS_MODE_PREFIX + " " + log; } + private void pushFile(String source, String dest) throws Exception { + SyncResult result = getSyncService().pushFile(source, dest, SyncService.getNullProgressMonitor()); + if ( result.getCode() != SyncService.RESULT_OK ) { + throw new Exception(result.getMessage()); + } + } + /** * Creates a new exception. * -- 2.7.4