[Title]Bug fix as sdblib is refactored
authorBonyong.lee <bonyong.lee@samsung.com>
Wed, 5 Jun 2013 07:51:14 +0000 (16:51 +0900)
committerBonyong.lee <bonyong.lee@samsung.com>
Wed, 5 Jun 2013 07:51:14 +0000 (16:51 +0900)
[Type]
[Module]
[Priority]
[CQ#]
[Redmine#]
[Problem]
[Cause]
[Solution]

org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchUtils.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmCommanderDevice.java

index 30c6ca4..be963eb 100644 (file)
 
 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) {
index c779858..6851360 100644 (file)
@@ -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);
             }