From: Manolo Carrasco Date: Tue, 13 Sep 2011 18:21:54 +0000 (+0000) Subject: JsCache.isEmpty failed with empty string keys. Fix GQuery.toString in order not to... X-Git-Tag: release-1.3.2~207 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=823278409dda928d9f338d8eca64859472eca801;p=gwtquery.git JsCache.isEmpty failed with empty string keys. Fix GQuery.toString in order not to fail with non printable elements --- 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 { 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) /*-{