Return-Path: X-Original-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A9F3798DE for ; Tue, 3 Jan 2012 18:58:38 +0000 (UTC) Received: (qmail 78401 invoked by uid 500); 3 Jan 2012 18:58:38 -0000 Delivered-To: apmail-incubator-callback-commits-archive@incubator.apache.org Received: (qmail 78381 invoked by uid 500); 3 Jan 2012 18:58:38 -0000 Mailing-List: contact callback-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-commits@incubator.apache.org Received: (qmail 78370 invoked by uid 99); 3 Jan 2012 18:58:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jan 2012 18:58:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.114] (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jan 2012 18:58:37 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id E5FEB315749; Tue, 3 Jan 2012 18:57:09 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bowserj@apache.org To: callback-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [25/50] git commit: cleaning up handling of exceptions. removing unnecessary exception declaration in FileUtils. removing try-catch that should not have been done in HttpHandler Message-Id: <20120103185709.E5FEB315749@tyr.zones.apache.org> Date: Tue, 3 Jan 2012 18:57:09 +0000 (UTC) cleaning up handling of exceptions. removing unnecessary exception declaration in FileUtils. removing try-catch that should not have been done in HttpHandler Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/cd5bf619 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/cd5bf619 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/cd5bf619 Branch: refs/heads/master Commit: cd5bf6195e3a78ac000f089664481f56a8956e07 Parents: 7c8db0e Author: William Shen Authored: Wed Nov 23 10:52:43 2011 -0800 Committer: William Shen Committed: Wed Nov 23 10:52:43 2011 -0800 ---------------------------------------------------------------------- framework/src/com/phonegap/FileUtils.java | 2 +- framework/src/com/phonegap/HttpHandler.java | 31 ++++++++++----------- 2 files changed, 16 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/cd5bf619/framework/src/com/phonegap/FileUtils.java ---------------------------------------------------------------------- diff --git a/framework/src/com/phonegap/FileUtils.java b/framework/src/com/phonegap/FileUtils.java index 00aa9ce..5f94856 100755 --- a/framework/src/com/phonegap/FileUtils.java +++ b/framework/src/com/phonegap/FileUtils.java @@ -531,7 +531,7 @@ public class FileUtils extends Plugin { * @throws NoModificationAllowedException * @throws InvalidModificationException */ - private JSONObject moveDirectory(File srcDir, File destinationDir) throws JSONException, FileExistsException, NoModificationAllowedException, InvalidModificationException { + private JSONObject moveDirectory(File srcDir, File destinationDir) throws JSONException, InvalidModificationException { // Renaming a file to an existing directory should fail if (destinationDir.exists() && destinationDir.isFile()) { throw new InvalidModificationException("Can't rename a file to a directory"); http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/cd5bf619/framework/src/com/phonegap/HttpHandler.java ---------------------------------------------------------------------- diff --git a/framework/src/com/phonegap/HttpHandler.java b/framework/src/com/phonegap/HttpHandler.java index 156d5a2..78b8df5 100755 --- a/framework/src/com/phonegap/HttpHandler.java +++ b/framework/src/com/phonegap/HttpHandler.java @@ -20,6 +20,7 @@ package com.phonegap; import java.io.EOFException; import java.io.FileOutputStream; +import java.io.IOException; import java.io.InputStream; import org.apache.http.HttpEntity; @@ -56,27 +57,25 @@ public class HttpHandler { return entity; } - private void writeToDisk(HttpEntity entity, String file) throws EOFException + private void writeToDisk(HttpEntity entity, String file) throws IllegalStateException, IOException /** * writes a HTTP entity to the specified filename and location on disk */ { int i=0; String FilePath="/sdcard/" + file; - try { - InputStream in = entity.getContent(); - byte buff[] = new byte[1024]; - FileOutputStream out= - new FileOutputStream(FilePath); - do { - int numread = in.read(buff); - if (numread <= 0) - break; - out.write(buff, 0, numread); - i++; - } while (true); - out.flush(); - out.close(); - } catch (Exception e) { e.printStackTrace(); } + InputStream in = entity.getContent(); + byte buff[] = new byte[1024]; + FileOutputStream out= + new FileOutputStream(FilePath); + do { + int numread = in.read(buff); + if (numread <= 0) + break; + out.write(buff, 0, numread); + i++; + } while (true); + out.flush(); + out.close(); } }