diff --git a/pom.xml b/pom.xml
index 9143919..a722079 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
3.3.0-SNAPSHOTPlayerVaultshttp://dev.bukkit.org/server-mods/playervaults/
-
+
UTF-8
diff --git a/src/main/assembly/package.xml b/src/main/assembly/package.xml
index ac0be45..8d59a5f 100644
--- a/src/main/assembly/package.xml
+++ b/src/main/assembly/package.xml
@@ -1,11 +1,13 @@
-
- bin
- false
-
-
- ${project.build.directory}/${artifactId}.jar
- /
- ${project.name}.jar
-
-
+
+ bin
+ false
+
+
+ ${project.build.directory}/${artifactId}.jar
+ /
+ ${project.name}.jar
+
+
\ No newline at end of file
diff --git a/src/main/java/com/drtshock/playervaults/commands/Commands.java b/src/main/java/com/drtshock/playervaults/commands/Commands.java
index 7ce16cb..e354bcf 100644
--- a/src/main/java/com/drtshock/playervaults/commands/Commands.java
+++ b/src/main/java/com/drtshock/playervaults/commands/Commands.java
@@ -17,37 +17,35 @@ public class Commands implements CommandExecutor {
if (sender instanceof Player) {
Player p = (Player) sender;
switch (args.length) {
- case 1:
- if (VaultOperations.openOwnVault(p, args[0]))
- PlayerVaults.IN_VAULT.put(sender.getName(), new VaultViewInfo(sender.getName(), Integer.parseInt(args[0])));
- break;
- case 2:
- if (VaultOperations.openOtherVault(p, args[0], args[1]))
- PlayerVaults.IN_VAULT.put(sender.getName(), new VaultViewInfo(args[0], Integer.parseInt(args[1])));
- break;
- default:
- sender.sendMessage(Lang.TITLE + "/pv ");
- sender.sendMessage(Lang.TITLE + "/pv ");
+ case 1:
+ if (VaultOperations.openOwnVault(p, args[0]))
+ PlayerVaults.IN_VAULT.put(sender.getName(), new VaultViewInfo(sender.getName(), Integer.parseInt(args[0])));
+ break;
+ case 2:
+ if (VaultOperations.openOtherVault(p, args[0], args[1]))
+ PlayerVaults.IN_VAULT.put(sender.getName(), new VaultViewInfo(args[0], Integer.parseInt(args[1])));
+ break;
+ default:
+ sender.sendMessage(Lang.TITLE + "/pv ");
+ sender.sendMessage(Lang.TITLE + "/pv ");
}
- }
- else sender.sendMessage(Lang.TITLE.toString() + ChatColor.RED + Lang.PLAYER_ONLY);
+ } else sender.sendMessage(Lang.TITLE.toString() + ChatColor.RED + Lang.PLAYER_ONLY);
} else if (cmd.getName().equalsIgnoreCase("pvdel")) {
switch (args.length) {
- case 1:
- if (sender instanceof Player) {
- Player p = (Player) sender;
- VaultOperations.deleteOwnVault(p, args[0]);
- }
- else {
- sender.sendMessage(Lang.TITLE.toString() + ChatColor.RED + Lang.PLAYER_ONLY);
- }
- break;
- case 2:
- VaultOperations.deleteOtherVault(sender, args[0], args[1]);
- break;
- default:
- sender.sendMessage(Lang.TITLE + "/pvdel ");
- sender.sendMessage(Lang.TITLE + "/pvdel ");
+ case 1:
+ if (sender instanceof Player) {
+ Player p = (Player) sender;
+ VaultOperations.deleteOwnVault(p, args[0]);
+ } else {
+ sender.sendMessage(Lang.TITLE.toString() + ChatColor.RED + Lang.PLAYER_ONLY);
+ }
+ break;
+ case 2:
+ VaultOperations.deleteOtherVault(sender, args[0], args[1]);
+ break;
+ default:
+ sender.sendMessage(Lang.TITLE + "/pvdel ");
+ sender.sendMessage(Lang.TITLE + "/pvdel ");
}
} else if (cmd.getName().equalsIgnoreCase("workbench")) {
if (sender.hasPermission("playervaults.workbench")) {
@@ -75,8 +73,7 @@ public class Commands implements CommandExecutor {
}
PlayerVaults.SET_SIGN.put(sender.getName(), new SignSetInfo(i));
sender.sendMessage(Lang.TITLE.toString() + Lang.CLICK_A_SIGN);
- }
- else if (args.length >= 2) {
+ } else if (args.length >= 2) {
int i = 0;
try {
i = Integer.parseInt(args[1]);
diff --git a/src/main/java/com/drtshock/playervaults/util/EconomyOperations.java b/src/main/java/com/drtshock/playervaults/util/EconomyOperations.java
index 4d150a3..b200c0c 100644
--- a/src/main/java/com/drtshock/playervaults/util/EconomyOperations.java
+++ b/src/main/java/com/drtshock/playervaults/util/EconomyOperations.java
@@ -85,8 +85,7 @@ public class EconomyOperations {
player.sendMessage(Lang.TITLE.toString() + ChatColor.RED + Lang.VAULT_DOES_NOT_EXIST);
return false;
}
- }
- else {
+ } else {
player.sendMessage(Lang.TITLE.toString() + ChatColor.RED + Lang.VAULT_DOES_NOT_EXIST);
return false;
}
diff --git a/src/main/java/com/drtshock/playervaults/util/Metrics.java b/src/main/java/com/drtshock/playervaults/util/Metrics.java
index 98e3e58..dae78d6 100644
--- a/src/main/java/com/drtshock/playervaults/util/Metrics.java
+++ b/src/main/java/com/drtshock/playervaults/util/Metrics.java
@@ -561,7 +561,8 @@ public class Metrics {
/**
* Called when the server owner decides to opt-out of Metrics while the server is running.
*/
- protected void onOptOut() {}
+ protected void onOptOut() {
+ }
}
@@ -613,7 +614,8 @@ public class Metrics {
/**
* Called after the website graphs have been updated
*/
- public void reset() {}
+ public void reset() {
+ }
@Override
public int hashCode() {
diff --git a/src/main/java/com/drtshock/playervaults/util/Serialization.java b/src/main/java/com/drtshock/playervaults/util/Serialization.java
index b5a2a89..6ee258e 100644
--- a/src/main/java/com/drtshock/playervaults/util/Serialization.java
+++ b/src/main/java/com/drtshock/playervaults/util/Serialization.java
@@ -64,8 +64,7 @@ public class Serialization {
for (ConfigurationSerializable cs : items) {
if (cs == null) {
result.add("null");
- }
- else {
+ } else {
result.add(new JSONObject(serialize(cs)).toString());
}
}
@@ -80,8 +79,7 @@ public class Serialization {
for (String piece : stringItems) {
if (piece.equalsIgnoreCase("null")) {
contents.add(null);
- }
- else {
+ } else {
try {
ItemStack item = (ItemStack) deserialize(toMap(new JSONObject(piece)));
contents.add(item);
diff --git a/src/main/java/com/drtshock/playervaults/util/VaultHolder.java b/src/main/java/com/drtshock/playervaults/util/VaultHolder.java
index 063f483..4feb6f2 100644
--- a/src/main/java/com/drtshock/playervaults/util/VaultHolder.java
+++ b/src/main/java/com/drtshock/playervaults/util/VaultHolder.java
@@ -14,7 +14,7 @@ public class VaultHolder implements InventoryHolder {
/**
* Creates a new vault holder
- *
+ *
* @param vaultNumber the vault number this holder is using
*/
public VaultHolder(int vaultNumber) {
@@ -23,7 +23,7 @@ public class VaultHolder implements InventoryHolder {
/**
* Gets the vault number this holder is currently using
- *
+ *
* @return the vault number
*/
public int getVaultNumber() {
@@ -32,7 +32,7 @@ public class VaultHolder implements InventoryHolder {
/**
* Sets the inventory this vault holder holds
- *
+ *
* @param inventory the inventory, may be null
*/
public void setInventory(Inventory inventory) {
diff --git a/src/main/java/org/json/JSONArray.java b/src/main/java/org/json/JSONArray.java
index d86553c..e45fcc5 100644
--- a/src/main/java/org/json/JSONArray.java
+++ b/src/main/java/org/json/JSONArray.java
@@ -105,7 +105,7 @@ public class JSONArray {
}
if (x.nextClean() != ']') {
x.back();
- for (;;) {
+ for (; ; ) {
if (x.nextClean() == ',') {
x.back();
this.myArrayList.add(JSONObject.NULL);
@@ -114,17 +114,17 @@ public class JSONArray {
this.myArrayList.add(x.nextValue());
}
switch (x.nextClean()) {
- case ';':
- case ',':
- if (x.nextClean() == ']') {
+ case ';':
+ case ',':
+ if (x.nextClean() == ']') {
+ return;
+ }
+ x.back();
+ break;
+ case ']':
return;
- }
- x.back();
- break;
- case ']':
- return;
- default:
- throw x.syntaxError("Expected a ',' or ']'");
+ default:
+ throw x.syntaxError("Expected a ',' or ']'");
}
}
}
@@ -192,7 +192,7 @@ public class JSONArray {
* The string values "true" and "false" are converted to boolean.
*
* @param index The index must be between 0 and length() - 1.
- * @return The truth.
+ * @return The truth.
* @throws JSONException If there is no value for the index or if the
* value is not convertible to boolean.
*/
@@ -200,11 +200,11 @@ public class JSONArray {
Object object = this.get(index);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
- ((String) object).equalsIgnoreCase("false"))) {
+ ((String) object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.TRUE) ||
(object instanceof String &&
- ((String) object).equalsIgnoreCase("true"))) {
+ ((String) object).equalsIgnoreCase("true"))) {
return true;
}
throw new JSONException("JSONArray[" + index + "] is not a boolean.");
@@ -214,8 +214,8 @@ public class JSONArray {
* Get the double value associated with an index.
*
* @param index The index must be between 0 and length() - 1.
- * @return The value.
- * @throws JSONException If the key is not found or if the value cannot
+ * @return The value.
+ * @throws JSONException If the key is not found or if the value cannot
* be converted to a number.
*/
public double getDouble(int index) throws JSONException {
@@ -234,8 +234,8 @@ public class JSONArray {
* Get the int value associated with an index.
*
* @param index The index must be between 0 and length() - 1.
- * @return The value.
- * @throws JSONException If the key is not found or if the value is not a number.
+ * @return The value.
+ * @throws JSONException If the key is not found or if the value is not a number.
*/
public int getInt(int index) throws JSONException {
Object object = this.get(index);
@@ -252,7 +252,7 @@ public class JSONArray {
/**
* Get the JSONArray associated with an index.
* @param index The index must be between 0 and length() - 1.
- * @return A JSONArray value.
+ * @return A JSONArray value.
* @throws JSONException If there is no value for the index. or if the
* value is not a JSONArray
*/
@@ -268,7 +268,7 @@ public class JSONArray {
/**
* Get the JSONObject associated with an index.
* @param index subscript
- * @return A JSONObject value.
+ * @return A JSONObject value.
* @throws JSONException If there is no value for the index or if the
* value is not a JSONObject
*/
@@ -285,8 +285,8 @@ public class JSONArray {
* Get the long value associated with an index.
*
* @param index The index must be between 0 and length() - 1.
- * @return The value.
- * @throws JSONException If the key is not found or if the value cannot
+ * @return The value.
+ * @throws JSONException If the key is not found or if the value cannot
* be converted to a number.
*/
public long getLong(int index) throws JSONException {
@@ -304,7 +304,7 @@ public class JSONArray {
/**
* Get the string associated with an index.
* @param index The index must be between 0 and length() - 1.
- * @return A string value.
+ * @return A string value.
* @throws JSONException If there is no string value for the index.
*/
public String getString(int index) throws JSONException {
@@ -357,7 +357,7 @@ public class JSONArray {
/**
* Get the optional object value associated with an index.
* @param index The index must be between 0 and length() - 1.
- * @return An object value, or null if there is no
+ * @return An object value, or null if there is no
* object at that index.
*/
public Object opt(int index) {
@@ -372,7 +372,7 @@ public class JSONArray {
* or if the value is not Boolean.TRUE or the String "true".
*
* @param index The index must be between 0 and length() - 1.
- * @return The truth.
+ * @return The truth.
*/
public boolean optBoolean(int index) {
return this.optBoolean(index, false);
@@ -385,7 +385,7 @@ public class JSONArray {
*
* @param index The index must be between 0 and length() - 1.
* @param defaultValue A boolean default.
- * @return The truth.
+ * @return The truth.
*/
public boolean optBoolean(int index, boolean defaultValue) {
try {
@@ -401,7 +401,7 @@ public class JSONArray {
* or if the value is not a number and cannot be converted to a number.
*
* @param index The index must be between 0 and length() - 1.
- * @return The value.
+ * @return The value.
*/
public double optDouble(int index) {
return this.optDouble(index, Double.NaN);
@@ -414,7 +414,7 @@ public class JSONArray {
*
* @param index subscript
* @param defaultValue The default value.
- * @return The value.
+ * @return The value.
*/
public double optDouble(int index, double defaultValue) {
try {
@@ -430,7 +430,7 @@ public class JSONArray {
* or if the value is not a number and cannot be converted to a number.
*
* @param index The index must be between 0 and length() - 1.
- * @return The value.
+ * @return The value.
*/
public int optInt(int index) {
return this.optInt(index, 0);
@@ -442,7 +442,7 @@ public class JSONArray {
* or if the value is not a number and cannot be converted to a number.
* @param index The index must be between 0 and length() - 1.
* @param defaultValue The default value.
- * @return The value.
+ * @return The value.
*/
public int optInt(int index, int defaultValue) {
try {
@@ -455,7 +455,7 @@ public class JSONArray {
/**
* Get the optional JSONArray associated with an index.
* @param index subscript
- * @return A JSONArray value, or null if the index has no value,
+ * @return A JSONArray value, or null if the index has no value,
* or if the value is not a JSONArray.
*/
public JSONArray optJSONArray(int index) {
@@ -469,7 +469,7 @@ public class JSONArray {
* no value, or if the value is not a JSONObject.
*
* @param index The index must be between 0 and length() - 1.
- * @return A JSONObject value.
+ * @return A JSONObject value.
*/
public JSONObject optJSONObject(int index) {
Object o = this.opt(index);
@@ -482,7 +482,7 @@ public class JSONArray {
* or if the value is not a number and cannot be converted to a number.
*
* @param index The index must be between 0 and length() - 1.
- * @return The value.
+ * @return The value.
*/
public long optLong(int index) {
return this.optLong(index, 0);
@@ -494,7 +494,7 @@ public class JSONArray {
* or if the value is not a number and cannot be converted to a number.
* @param index The index must be between 0 and length() - 1.
* @param defaultValue The default value.
- * @return The value.
+ * @return The value.
*/
public long optLong(int index, long defaultValue) {
try {
@@ -510,7 +510,7 @@ public class JSONArray {
* is not a string and is not null, then it is coverted to a string.
*
* @param index The index must be between 0 and length() - 1.
- * @return A String value.
+ * @return A String value.
*/
public String optString(int index) {
return this.optString(index, "");
@@ -522,7 +522,7 @@ public class JSONArray {
*
* @param index The index must be between 0 and length() - 1.
* @param defaultValue The default value.
- * @return A String value.
+ * @return A String value.
*/
public String optString(int index, String defaultValue) {
Object object = this.opt(index);
@@ -546,7 +546,7 @@ public class JSONArray {
* Put a value in the JSONArray, where the value will be a
* JSONArray which is produced from a Collection.
* @param value A Collection value.
- * @return this.
+ * @return this.
*/
public JSONArray put(Collection> value) {
this.put(new JSONArray(value));
@@ -593,7 +593,7 @@ public class JSONArray {
* Put a value in the JSONArray, where the value will be a
* JSONObject which is produced from a Map.
* @param value A Map value.
- * @return this.
+ * @return this.
*/
public JSONArray put(Map, ?> value) {
this.put(new JSONObject(value));
@@ -631,7 +631,7 @@ public class JSONArray {
* JSONArray which is produced from a Collection.
* @param index The subscript.
* @param value A Collection value.
- * @return this.
+ * @return this.
* @throws JSONException If the index is negative or if the value is
* not finite.
*/
@@ -688,7 +688,7 @@ public class JSONArray {
* JSONObject that is produced from a Map.
* @param index The subscript.
* @param value The Map value.
- * @return this.
+ * @return this.
* @throws JSONException If the index is negative or if the the value is
* an invalid number.
*/
diff --git a/src/main/java/org/json/JSONObject.java b/src/main/java/org/json/JSONObject.java
index 2828308..e47e710 100644
--- a/src/main/java/org/json/JSONObject.java
+++ b/src/main/java/org/json/JSONObject.java
@@ -118,7 +118,7 @@ public class JSONObject {
/**
* There is only intended to be a single instance of the NULL object,
* so the clone method returns itself.
- * @return NULL.
+ * @return NULL.
*/
protected final Object clone() {
return this;
@@ -196,16 +196,16 @@ public class JSONObject {
if (x.nextClean() != '{') {
throw x.syntaxError("A JSONObject text must begin with '{'");
}
- for (;;) {
+ for (; ; ) {
c = x.nextClean();
switch (c) {
- case 0:
- throw x.syntaxError("A JSONObject text must end with '}'");
- case '}':
- return;
- default:
- x.back();
- key = x.nextValue().toString();
+ case 0:
+ throw x.syntaxError("A JSONObject text must end with '}'");
+ case '}':
+ return;
+ default:
+ x.back();
+ key = x.nextValue().toString();
}
// The key is followed by ':'. We will also tolerate '=' or '=>'.
@@ -223,17 +223,17 @@ public class JSONObject {
// Pairs are separated by ','. We will also tolerate ';'.
switch (x.nextClean()) {
- case ';':
- case ',':
- if (x.nextClean() == '}') {
+ case ';':
+ case ',':
+ if (x.nextClean() == '}') {
+ return;
+ }
+ x.back();
+ break;
+ case '}':
return;
- }
- x.back();
- break;
- case '}':
- return;
- default:
- throw x.syntaxError("Expected a ',' or '}'");
+ default:
+ throw x.syntaxError("Expected a ',' or '}'");
}
}
}
@@ -377,7 +377,7 @@ public class JSONObject {
public JSONObject accumulate(
String key,
Object value
- ) throws JSONException {
+ ) throws JSONException {
testValidity(value);
Object object = this.opt(key);
if (object == null) {
@@ -447,8 +447,8 @@ public class JSONObject {
* Get the value object associated with a key.
*
* @param key A key string.
- * @return The object associated with the key.
- * @throws JSONException if the key is not found.
+ * @return The object associated with the key.
+ * @throws JSONException if the key is not found.
*/
public Object get(String key) throws JSONException {
if (key == null) {
@@ -466,19 +466,19 @@ public class JSONObject {
* Get the boolean value associated with a key.
*
* @param key A key string.
- * @return The truth.
- * @throws JSONException
+ * @return The truth.
+ * @throws JSONException
* if the value is not a Boolean or the String "true" or "false".
*/
public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
- ((String) object).equalsIgnoreCase("false"))) {
+ ((String) object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.TRUE) ||
(object instanceof String &&
- ((String) object).equalsIgnoreCase("true"))) {
+ ((String) object).equalsIgnoreCase("true"))) {
return true;
}
throw new JSONException("JSONObject[" + quote(key) +
@@ -488,7 +488,7 @@ public class JSONObject {
/**
* Get the double value associated with a key.
* @param key A key string.
- * @return The numeric value.
+ * @return The numeric value.
* @throws JSONException if the key is not found or
* if the value is not a Number object and cannot be converted to a number.
*/
@@ -508,8 +508,8 @@ public class JSONObject {
* Get the int value associated with a key.
*
* @param key A key string.
- * @return The integer value.
- * @throws JSONException if the key is not found or if the value cannot
+ * @return The integer value.
+ * @throws JSONException if the key is not found or if the value cannot
* be converted to an integer.
*/
public int getInt(String key) throws JSONException {
@@ -528,8 +528,8 @@ public class JSONObject {
* Get the JSONArray value associated with a key.
*
* @param key A key string.
- * @return A JSONArray which is the value.
- * @throws JSONException if the key is not found or
+ * @return A JSONArray which is the value.
+ * @throws JSONException if the key is not found or
* if the value is not a JSONArray.
*/
public JSONArray getJSONArray(String key) throws JSONException {
@@ -545,8 +545,8 @@ public class JSONObject {
* Get the JSONObject value associated with a key.
*
* @param key A key string.
- * @return A JSONObject which is the value.
- * @throws JSONException if the key is not found or
+ * @return A JSONObject which is the value.
+ * @throws JSONException if the key is not found or
* if the value is not a JSONObject.
*/
public JSONObject getJSONObject(String key) throws JSONException {
@@ -562,8 +562,8 @@ public class JSONObject {
* Get the long value associated with a key.
*
* @param key A key string.
- * @return The long value.
- * @throws JSONException if the key is not found or if the value cannot
+ * @return The long value.
+ * @throws JSONException if the key is not found or if the value cannot
* be converted to a long.
*/
public long getLong(String key) throws JSONException {
@@ -624,8 +624,8 @@ public class JSONObject {
* Get the string associated with a key.
*
* @param key A key string.
- * @return A string which is the value.
- * @throws JSONException if there is no string value for the key.
+ * @return A string which is the value.
+ * @throws JSONException if there is no string value for the key.
*/
public String getString(String key) throws JSONException {
Object object = this.get(key);
@@ -639,7 +639,7 @@ public class JSONObject {
/**
* Determine if the JSONObject contains a specific key.
* @param key A key string.
- * @return true if the key exists in the JSONObject.
+ * @return true if the key exists in the JSONObject.
*/
public boolean has(String key) {
return this.map.containsKey(key);
@@ -676,7 +676,7 @@ public class JSONObject {
* Determine if the value associated with the key is null or if there is
* no value.
* @param key A key string.
- * @return true if there is no value associated with the key or if
+ * @return true if there is no value associated with the key or if
* the value is the JSONObject.NULL object.
*/
public boolean isNull(String key) {
@@ -756,7 +756,7 @@ public class JSONObject {
/**
* Get an optional value associated with a key.
* @param key A key string.
- * @return An object which is the value, or null if there is no value.
+ * @return An object which is the value, or null if there is no value.
*/
public Object opt(String key) {
return key == null ? null : this.map.get(key);
@@ -768,7 +768,7 @@ public class JSONObject {
* Boolean.TRUE or the String "true".
*
* @param key A key string.
- * @return The truth.
+ * @return The truth.
*/
public boolean optBoolean(String key) {
return this.optBoolean(key, false);
@@ -781,7 +781,7 @@ public class JSONObject {
*
* @param key A key string.
* @param defaultValue The default.
- * @return The truth.
+ * @return The truth.
*/
public boolean optBoolean(String key, boolean defaultValue) {
try {
@@ -798,7 +798,7 @@ public class JSONObject {
* a number.
*
* @param key A string which is the key.
- * @return An object which is the value.
+ * @return An object which is the value.
*/
public double optDouble(String key) {
return this.optDouble(key, Double.NaN);
@@ -812,7 +812,7 @@ public class JSONObject {
*
* @param key A key string.
* @param defaultValue The default.
- * @return An object which is the value.
+ * @return An object which is the value.
*/
public double optDouble(String key, double defaultValue) {
try {
@@ -829,7 +829,7 @@ public class JSONObject {
* a number.
*
* @param key A key string.
- * @return An object which is the value.
+ * @return An object which is the value.
*/
public int optInt(String key) {
return this.optInt(key, 0);
@@ -843,7 +843,7 @@ public class JSONObject {
*
* @param key A key string.
* @param defaultValue The default.
- * @return An object which is the value.
+ * @return An object which is the value.
*/
public int optInt(String key, int defaultValue) {
try {
@@ -859,7 +859,7 @@ public class JSONObject {
* JSONArray.
*
* @param key A key string.
- * @return A JSONArray which is the value.
+ * @return A JSONArray which is the value.
*/
public JSONArray optJSONArray(String key) {
Object o = this.opt(key);
@@ -872,7 +872,7 @@ public class JSONObject {
* JSONObject.
*
* @param key A key string.
- * @return A JSONObject which is the value.
+ * @return A JSONObject which is the value.
*/
public JSONObject optJSONObject(String key) {
Object object = this.opt(key);
@@ -886,7 +886,7 @@ public class JSONObject {
* a number.
*
* @param key A key string.
- * @return An object which is the value.
+ * @return An object which is the value.
*/
public long optLong(String key) {
return this.optLong(key, 0);
@@ -900,7 +900,7 @@ public class JSONObject {
*
* @param key A key string.
* @param defaultValue The default.
- * @return An object which is the value.
+ * @return An object which is the value.
*/
public long optLong(String key, long defaultValue) {
try {
@@ -916,7 +916,7 @@ public class JSONObject {
* a string and is not null, then it is converted to a string.
*
* @param key A key string.
- * @return A string which is the value.
+ * @return A string which is the value.
*/
public String optString(String key) {
return this.optString(key, "");
@@ -928,7 +928,7 @@ public class JSONObject {
*
* @param key A key string.
* @param defaultValue The default.
- * @return A string which is the value.
+ * @return A string which is the value.
*/
public String optString(String key, String defaultValue) {
Object object = this.opt(key);
@@ -1000,7 +1000,7 @@ public class JSONObject {
* JSONArray which is produced from a Collection.
* @param key A key string.
* @param value A Collection value.
- * @return this.
+ * @return this.
* @throws JSONException
*/
public JSONObject put(String key, Collection value) throws JSONException {
@@ -1052,7 +1052,7 @@ public class JSONObject {
* JSONObject which is produced from a Map.
* @param key A key string.
* @param value A Map value.
- * @return this.
+ * @return this.
* @throws JSONException
*/
public JSONObject put(String key, Map value) throws JSONException {
@@ -1136,7 +1136,7 @@ public class JSONObject {
* allowing JSON text to be delivered in HTML. In JSON text, a string
* cannot contain a control character or an unescaped quote or backslash.
* @param string A String
- * @return A String correctly formatted for insertion in a JSON text.
+ * @return A String correctly formatted for insertion in a JSON text.
*/
public static String quote(String string) {
StringWriter sw = new StringWriter();
@@ -1167,42 +1167,42 @@ public class JSONObject {
b = c;
c = string.charAt(i);
switch (c) {
- case '\\':
- case '"':
- w.write('\\');
- w.write(c);
- break;
- case '/':
- if (b == '<') {
+ case '\\':
+ case '"':
w.write('\\');
- }
- w.write(c);
- break;
- case '\b':
- w.write("\\b");
- break;
- case '\t':
- w.write("\\t");
- break;
- case '\n':
- w.write("\\n");
- break;
- case '\f':
- w.write("\\f");
- break;
- case '\r':
- w.write("\\r");
- break;
- default:
- if (c < ' ' || (c >= '\u0080' && c < '\u00a0')
- || (c >= '\u2000' && c < '\u2100')) {
- w.write("\\u");
- hhhh = Integer.toHexString(c);
- w.write("0000", 0, 4 - hhhh.length());
- w.write(hhhh);
- } else {
w.write(c);
- }
+ break;
+ case '/':
+ if (b == '<') {
+ w.write('\\');
+ }
+ w.write(c);
+ break;
+ case '\b':
+ w.write("\\b");
+ break;
+ case '\t':
+ w.write("\\t");
+ break;
+ case '\n':
+ w.write("\\n");
+ break;
+ case '\f':
+ w.write("\\f");
+ break;
+ case '\r':
+ w.write("\\r");
+ break;
+ default:
+ if (c < ' ' || (c >= '\u0080' && c < '\u00a0')
+ || (c >= '\u2000' && c < '\u2100')) {
+ w.write("\\u");
+ hhhh = Integer.toHexString(c);
+ w.write("0000", 0, 4 - hhhh.length());
+ w.write(hhhh);
+ } else {
+ w.write(c);
+ }
}
}
w.write('"');
@@ -1471,7 +1471,7 @@ public class JSONObject {
}
static final Writer writeValue(Writer writer, Object value,
- int indentFactor, int indent) throws JSONException, IOException {
+ int indentFactor, int indent) throws JSONException, IOException {
if (value == null || value.equals(null)) {
writer.write("null");
} else if (value instanceof JSONObject) {
diff --git a/src/main/java/org/json/JSONTokener.java b/src/main/java/org/json/JSONTokener.java
index 7c0f9ee..bfe3daf 100644
--- a/src/main/java/org/json/JSONTokener.java
+++ b/src/main/java/org/json/JSONTokener.java
@@ -100,7 +100,7 @@ public class JSONTokener {
* Get the hex value of a character (base16).
* @param c A character between '0' and '9' or between 'A' and 'F' or
* between 'a' and 'f'.
- * @return An int between 0 and 15, or -1 if c was not a hex digit.
+ * @return An int between 0 and 15, or -1 if c was not a hex digit.
*/
public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
@@ -189,7 +189,7 @@ public class JSONTokener {
* Get the next n characters.
*
* @param n The number of characters to take.
- * @return A string of n characters.
+ * @return A string of n characters.
* @throws JSONException
* Substring bounds error if there are not
* n characters remaining in the source string.
@@ -215,10 +215,10 @@ public class JSONTokener {
/**
* Get the next char in the string, skipping whitespace.
* @throws JSONException
- * @return A character, or 0 if there are no more characters.
+ * @return A character, or 0 if there are no more characters.
*/
public char nextClean() throws JSONException {
- for (;;) {
+ for (; ; ) {
char c = this.next();
if (c == 0 || c > ' ') {
return c;
@@ -234,55 +234,55 @@ public class JSONTokener {
* @param quote The quoting character, either
* " (double quote) or
* ' (single quote).
- * @return A String.
+ * @return A String.
* @throws JSONException Unterminated string.
*/
public String nextString(char quote) throws JSONException {
char c;
StringBuffer sb = new StringBuffer();
- for (;;) {
+ for (; ; ) {
c = this.next();
switch (c) {
- case 0:
- case '\n':
- case '\r':
- throw this.syntaxError("Unterminated string");
- case '\\':
- c = this.next();
- switch (c) {
- case 'b':
- sb.append('\b');
- break;
- case 't':
- sb.append('\t');
- break;
- case 'n':
- sb.append('\n');
- break;
- case 'f':
- sb.append('\f');
- break;
- case 'r':
- sb.append('\r');
- break;
- case 'u':
- sb.append((char) Integer.parseInt(this.next(4), 16));
- break;
- case '"':
- case '\'':
+ case 0:
+ case '\n':
+ case '\r':
+ throw this.syntaxError("Unterminated string");
case '\\':
- case '/':
- sb.append(c);
+ c = this.next();
+ switch (c) {
+ case 'b':
+ sb.append('\b');
+ break;
+ case 't':
+ sb.append('\t');
+ break;
+ case 'n':
+ sb.append('\n');
+ break;
+ case 'f':
+ sb.append('\f');
+ break;
+ case 'r':
+ sb.append('\r');
+ break;
+ case 'u':
+ sb.append((char) Integer.parseInt(this.next(4), 16));
+ break;
+ case '"':
+ case '\'':
+ case '\\':
+ case '/':
+ sb.append(c);
+ break;
+ default:
+ throw this.syntaxError("Illegal escape.");
+ }
break;
default:
- throw this.syntaxError("Illegal escape.");
- }
- break;
- default:
- if (c == quote) {
- return sb.toString();
- }
- sb.append(c);
+ if (c == quote) {
+ return sb.toString();
+ }
+ sb.append(c);
}
}
}
@@ -291,11 +291,11 @@ public class JSONTokener {
* Get the text up but not including the specified character or the
* end of line, whichever comes first.
* @param delimiter A delimiter character.
- * @return A string.
+ * @return A string.
*/
public String nextTo(char delimiter) throws JSONException {
StringBuffer sb = new StringBuffer();
- for (;;) {
+ for (; ; ) {
char c = this.next();
if (c == delimiter || c == 0 || c == '\n' || c == '\r') {
if (c != 0) {
@@ -316,7 +316,7 @@ public class JSONTokener {
public String nextTo(String delimiters) throws JSONException {
char c;
StringBuffer sb = new StringBuffer();
- for (;;) {
+ for (; ; ) {
c = this.next();
if (delimiters.indexOf(c) >= 0 || c == 0 ||
c == '\n' || c == '\r') {
@@ -341,15 +341,15 @@ public class JSONTokener {
String string;
switch (c) {
- case '"':
- case '\'':
- return this.nextString(c);
- case '{':
- this.back();
- return new JSONObject(this);
- case '[':
- this.back();
- return new JSONArray(this);
+ case '"':
+ case '\'':
+ return this.nextString(c);
+ case '{':
+ this.back();
+ return new JSONObject(this);
+ case '[':
+ this.back();
+ return new JSONArray(this);
}
/*
@@ -411,7 +411,7 @@ public class JSONTokener {
* Make a JSONException to signal a syntax error.
*
* @param message The error message.
- * @return A JSONException object, suitable for throwing
+ * @return A JSONException object, suitable for throwing
*/
public JSONException syntaxError(String message) {
return new JSONException(message + this.toString());