aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManolo Carrasco <manolo@apache.org>2012-02-10 13:14:05 +0000
committerManolo Carrasco <manolo@apache.org>2012-02-10 13:14:05 +0000
commit7954537f5db66786a238b6199bb39bef51365687 (patch)
tree50a2aad4a70f3d7a918e3a22a0e3ceb3bcc5245e
parent204130f4e530250a2580ac821149c4c2c5b0e87a (diff)
downloadgwtquery-7954537f5db66786a238b6199bb39bef51365687.tar.gz
gwtquery-7954537f5db66786a238b6199bb39bef51365687.zip
Fixing a loop condition when trying to print a Properties object which is null
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/Properties.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/Properties.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/Properties.java
index 398960e3..c3502e34 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/Properties.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/Properties.java
@@ -137,8 +137,11 @@ public class Properties extends JavaScriptObject {
}
public final String toJsonString() {
- String ret = "";
+ // In dev-mode a null object casted to JavascriptObject does not throw a NPE
+ // e.g: System.out.println(((Properties)null).toJsonString());
+ if (this == null) return "null";
+ String ret = "";
for (String k : keys()){
String ky = k.matches("\\d+") ? k : "\"" + k + "\"";
JsCache o = getArray(k).cast();
@@ -154,6 +157,7 @@ public class Properties extends JavaScriptObject {
}
ret += "],";
} else {
+ System.out.println("N");
Properties p = getJavaScriptObject(k);
if (p != null) {
ret += ky + ":" + p.toJsonString() + ",";
@@ -168,6 +172,9 @@ public class Properties extends JavaScriptObject {
}
public final String toQueryString() {
+ // In dev-mode a null object casted to JavascriptObject does not throw a NPE
+ if (this == null) return "null";
+
String ret = "";
for (String k : keys()) {
ret += ret.isEmpty() ? "" : "&";