diff options
Diffstat (limited to 'ddms')
-rw-r--r-- | ddms/libs/ddmlib/src/com/android/ddmlib/SyncException.java | 2 | ||||
-rw-r--r-- | ddms/libs/ddmlib/src/com/android/ddmlib/SyncService.java | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/ddms/libs/ddmlib/src/com/android/ddmlib/SyncException.java b/ddms/libs/ddmlib/src/com/android/ddmlib/SyncException.java index 5f84f64..76de367 100644 --- a/ddms/libs/ddmlib/src/com/android/ddmlib/SyncException.java +++ b/ddms/libs/ddmlib/src/com/android/ddmlib/SyncException.java @@ -44,6 +44,8 @@ public class SyncException extends CanceledException { REMOTE_PATH_LENGTH("Remote path is too long."), /** error while reading local file. */ FILE_READ_ERROR("Reading local file failed!"), + /** error while writing local file. */ + FILE_WRITE_ERROR("Writing local file failed!"), /** attempting to push a directory. */ LOCAL_IS_DIRECTORY("Local path is a directory."), /** attempting to push a non-existent file. */ diff --git a/ddms/libs/ddmlib/src/com/android/ddmlib/SyncService.java b/ddms/libs/ddmlib/src/com/android/ddmlib/SyncService.java index 03a68aa..6a94d22 100644 --- a/ddms/libs/ddmlib/src/com/android/ddmlib/SyncService.java +++ b/ddms/libs/ddmlib/src/com/android/ddmlib/SyncService.java @@ -516,7 +516,13 @@ public final class SyncService { // create the stream to write in the file. We use a new try/catch block to differentiate // between file and network io exceptions. FileOutputStream fos = null; - fos = new FileOutputStream(f); + try { + fos = new FileOutputStream(f); + } catch (IOException e) { + Log.e("ddms", String.format("Failed to open local file %s for writing, Reason: %s", + f.getAbsolutePath(), e.toString())); + throw new SyncException(SyncError.FILE_WRITE_ERROR); + } // the buffer to read the data byte[] data = new byte[SYNC_DATA_MAX]; |