From 604e2d916a132955ceabc95b1242fe4e4adb4ff2 Mon Sep 17 00:00:00 2001 From: "Bonyong.lee" Date: Wed, 5 Jun 2013 16:51:14 +0900 Subject: [PATCH] [Title]Bug fix as sdblib is refactored [Type] [Module] [Priority] [CQ#] [Redmine#] [Problem] [Cause] [Solution] --- .../launch/wizards/PlatformLaunchUtils.java | 22 +++++++++++++++++----- .../pkg/commander/rpm/RpmCommanderDevice.java | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchUtils.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchUtils.java index 30c6ca4..be963eb 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchUtils.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchUtils.java @@ -27,11 +27,13 @@ package org.tizen.nativeplatform.launch.wizards; +import static org.tizen.common.util.IOUtil.tryClose; import static org.tizen.sdblib.service.SyncServiceConstants.RESULT_OK; import static org.tizen.sdblib.util.DeviceUtil.isOnline; import java.io.BufferedReader; import java.io.File; +import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; @@ -505,11 +507,21 @@ public class PlatformLaunchUtils { public void copyFileToDevice(IDevice device, String srcPath, String descPath) throws CoreException, TimeoutException, SdbCommandRejectedException, IOException { - SyncResult syncSuccess = device.getSyncService().push(srcPath, device.getFileEntry( descPath ) ); - - if (syncSuccess.getCode() != RESULT_OK) { - LaunchUtils.newCoreException(TizenLaunchMessages.CANNOT_TRANSFER_FILE, null); - } + + FileInputStream fileIn = null; + try + { + fileIn = new FileInputStream( srcPath ); + SyncResult syncSuccess = device.getSyncService().doPush(fileIn, device.getFileEntry( descPath ), null, -1 ); + + if (syncSuccess.getCode() != RESULT_OK) { + LaunchUtils.newCoreException(TizenLaunchMessages.CANNOT_TRANSFER_FILE, null); + } + } + finally + { + tryClose( fileIn ); + } } public boolean checkGdbServerInBuildSystem(String rootstrapPath) { diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmCommanderDevice.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmCommanderDevice.java index c779858..6851360 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmCommanderDevice.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmCommanderDevice.java @@ -58,7 +58,7 @@ public class RpmCommanderDevice extends RpmCommanderCommon { } catch (IOException e) { return new CommandStatus(IStatus.ERROR, "", e.getMessage(), e); } - SyncResult syncResult = syncService.push(filePath, device.getFileEntry( pathOnDevice.toOSString() ) ); + SyncResult syncResult = syncService.push(filePath, device.getFileEntry( TMP_DIR ) );// Fixxed if (syncResult.getCode() != RESULT_OK) { return new CommandStatus(IStatus.ERROR, "", syncResult.getMessage(), null); } -- 2.7.4