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.
* Reads the <code>STR_TREE_FILE</code>, and sets the <code>oldTree</code>.
*/
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));
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;
}
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);
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);
}
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.
*