diff options
author | Manolo Carrasco <manolo@apache.org> | 2011-09-13 18:21:54 +0000 |
---|---|---|
committer | Manolo Carrasco <manolo@apache.org> | 2011-09-13 18:21:54 +0000 |
commit | 823278409dda928d9f338d8eca64859472eca801 (patch) | |
tree | 8fd3309702788edbecadb75c6e64c5b4d9336bee /gwtquery-core | |
parent | 1bd70fec7ce6b9cf56101ee1c54db08ed4db411e (diff) | |
download | gwtquery-823278409dda928d9f338d8eca64859472eca801.tar.gz gwtquery-823278409dda928d9f338d8eca64859472eca801.zip |
JsCache.isEmpty failed with empty string keys. Fix GQuery.toString in order not to fail with non printable elements
Diffstat (limited to 'gwtquery-core')
-rw-r--r-- | gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java | 8 | ||||
-rw-r--r-- | gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsCache.java | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java index 6862e7bf..07798f37 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java @@ -3671,7 +3671,13 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { if (window.equals(e)) {
continue;
}
- r += (pretty && r.length() > 0 ? "\n " : "") + e.getString();
+ String elStr;
+ try {
+ elStr = e.getString();
+ } catch (Exception e2) {
+ elStr = "< " + (e == null ? "null" : e.getNodeName()) + "(gquery, error getting the element string representation: " + e2.getMessage() + ")/>";
+ }
+ r += (pretty && r.length() > 0 ? "\n " : "") + elStr;
}
return r;
}
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsCache.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsCache.java index 5a85be04..dea558ee 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsCache.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsCache.java @@ -95,9 +95,8 @@ public class JsCache extends JavaScriptObject { }-*/; public final native boolean isEmpty() /*-{ - var foo = ""; - for (foo in this) break; - return !foo; + for (k in this) return false; + return true; }-*/; public final native void put(int id, Object obj) /*-{ |