incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bcur...@apache.org
Subject [12/16] android commit: Unifying File API error code/response style
Date Fri, 17 Feb 2012 22:58:02 GMT
Unifying File API error code/response style


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/40637c14
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/40637c14
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/40637c14

Branch: refs/heads/master
Commit: 40637c14867d236029d48ac4236781da03eb0002
Parents: a84d2ea
Author: Fil Maj <filip.maj@nitobi.com>
Authored: Wed Feb 15 16:47:32 2012 -0800
Committer: Fil Maj <filip.maj@nitobi.com>
Committed: Wed Feb 15 16:47:32 2012 -0800

----------------------------------------------------------------------
 framework/src/org/apache/cordova/FileUtils.java |   27 ++++++------------
 1 files changed, 9 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/40637c14/framework/src/org/apache/cordova/FileUtils.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/FileUtils.java b/framework/src/org/apache/cordova/FileUtils.java
index 47bafee..b397f04 100755
--- a/framework/src/org/apache/cordova/FileUtils.java
+++ b/framework/src/org/apache/cordova/FileUtils.java
@@ -199,32 +199,23 @@ public class FileUtils extends Plugin {
                 }
                 return new PluginResult(status, result);
             } catch (FileNotFoundException e) {
-                JSONObject error = new JSONObject().put("code", FileUtils.NOT_FOUND_ERR);
-                return new PluginResult(PluginResult.Status.ERROR, error);
+                return new PluginResult(PluginResult.Status.ERROR, FileUtils.NOT_FOUND_ERR);
             } catch (FileExistsException e) {
-                JSONObject error = new JSONObject().put("code", FileUtils.PATH_EXISTS_ERR);
-                return new PluginResult(PluginResult.Status.ERROR, error);
+                return new PluginResult(PluginResult.Status.ERROR, FileUtils.PATH_EXISTS_ERR);
             } catch (NoModificationAllowedException e) {
-                JSONObject error = new JSONObject().put("code", FileUtils.NO_MODIFICATION_ALLOWED_ERR);
-                return new PluginResult(PluginResult.Status.ERROR, error);
+                return new PluginResult(PluginResult.Status.ERROR, FileUtils.NO_MODIFICATION_ALLOWED_ERR);
             } catch (JSONException e) {
-                JSONObject error = new JSONObject().put("code", FileUtils.NO_MODIFICATION_ALLOWED_ERR);
-                return new PluginResult(PluginResult.Status.ERROR, error);
+                return new PluginResult(PluginResult.Status.ERROR, FileUtils.NO_MODIFICATION_ALLOWED_ERR);
             } catch (InvalidModificationException e) {
-                JSONObject error = new JSONObject().put("code", FileUtils.INVALID_MODIFICATION_ERR);
-                return new PluginResult(PluginResult.Status.ERROR, error);
+                return new PluginResult(PluginResult.Status.ERROR, FileUtils.INVALID_MODIFICATION_ERR);
             } catch (MalformedURLException e) {
-                JSONObject error = new JSONObject().put("code", FileUtils.ENCODING_ERR);
-                return new PluginResult(PluginResult.Status.ERROR, error);
+                return new PluginResult(PluginResult.Status.ERROR, FileUtils.ENCODING_ERR);
             } catch (IOException e) {
-                JSONObject error = new JSONObject().put("code", FileUtils.INVALID_MODIFICATION_ERR);
-                return new PluginResult(PluginResult.Status.ERROR, error);
+                return new PluginResult(PluginResult.Status.ERROR, FileUtils.INVALID_MODIFICATION_ERR);
             } catch (EncodingException e) {
-                JSONObject error = new JSONObject().put("code", FileUtils.ENCODING_ERR);
-                return new PluginResult(PluginResult.Status.ERROR, error);
+                return new PluginResult(PluginResult.Status.ERROR, FileUtils.ENCODING_ERR);
             } catch (TypeMismatchException e) {
-                JSONObject error = new JSONObject().put("code", FileUtils.TYPE_MISMATCH_ERR);
-                return new PluginResult(PluginResult.Status.ERROR, error);
+                return new PluginResult(PluginResult.Status.ERROR, FileUtils.TYPE_MISMATCH_ERR);
             }
         } catch (JSONException e) {
             e.printStackTrace();


Mime
View raw message