From f6503f8476bbdcaf600b09ec1ff8126de9b75960 Mon Sep 17 00:00:00 2001 From: Bryce Curtis Date: Tue, 28 Feb 2012 22:30:27 -0600 Subject: [PATCH] File APIs should return error code instead of object. --- framework/src/org/apache/cordova/FileUtils.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/framework/src/org/apache/cordova/FileUtils.java b/framework/src/org/apache/cordova/FileUtils.java index f2cc980e..7dc26f32 100755 --- a/framework/src/org/apache/cordova/FileUtils.java +++ b/framework/src/org/apache/cordova/FileUtils.java @@ -131,8 +131,7 @@ public class FileUtils extends Plugin { long size = args.optLong(1); if (size != 0) { if (size > (DirectoryManager.getFreeDiskSpace(true)*1024)) { - JSONObject error = new JSONObject().put("code", FileUtils.QUOTA_EXCEEDED_ERR); - return new PluginResult(PluginResult.Status.ERROR, error); + return new PluginResult(PluginResult.Status.ERROR, FileUtils.QUOTA_EXCEEDED_ERR); } } JSONObject obj = requestFileSystem(args.getInt(0)); @@ -171,8 +170,7 @@ public class FileUtils extends Plugin { notifyDelete(args.getString(0)); return new PluginResult(status); } else { - 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); } } else if (action.equals("removeRecursively")) { @@ -180,8 +178,7 @@ public class FileUtils extends Plugin { if (success) { return new PluginResult(status); } else { - 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); } } else if (action.equals("moveTo")) {