From 7915a9a2d25a38b9ec45529d4bf82bd95bb2658a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Manuel=20Carrasco=20Mo=C3=B1ino?= Date: Fri, 15 Mar 2013 16:14:23 +0100 Subject: [PATCH] Enclose println used warn the user in dev mode in a block so as it does not generates any code in production --- .../src/main/java/com/google/gwt/query/client/GQuery.java | 4 +++- .../main/java/com/google/gwt/query/client/Properties.java | 6 ++++-- .../main/java/com/google/gwt/query/client/js/JsUtils.java | 5 +++-- 3 files changed, 10 insertions(+), 5 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 0fad3d5c..d2d0e486 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 @@ -274,7 +274,9 @@ public class GQuery implements Lazy { if (o instanceof IsWidget) { return $(Arrays.asList(o)); } - System.err.println("GQuery.$(Object o) could not wrap the type : " + o.getClass()); + if (!GWT.isProdMode()) { + System.err.println("GQuery.$(Object o) could not wrap the type : " + o.getClass()); + } } return $(); } 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 87840ec7..7999e10d 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 @@ -17,6 +17,7 @@ package com.google.gwt.query.client; import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.core.client.JsArrayMixed; +import com.google.gwt.core.shared.GWT; import com.google.gwt.query.client.js.JsCache; import com.google.gwt.query.client.js.JsUtils; @@ -35,8 +36,9 @@ public class Properties extends JavaScriptObject { try { return JsUtils.parseJSON(p); } catch (Exception e) { - String msg = e.getMessage(); - System.err.println("Error creating Properties: \n> " + properties + "\n< " + p + "\n" + msg); + if (!GWT.isProdMode()) { + System.err.println("Error creating Properties: \n> " + properties + "\n< " + p + "\n" + e.getMessage()); + } } } return create(); diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java index 645ccd15..2d9ba9dd 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java @@ -404,8 +404,9 @@ public class JsUtils { try { return utilsImpl.parseJSON(json); } catch (Exception e) { - System.err.println("Error while parsing json: " + e.getMessage() + ".\n" - + json); + if (!GWT.isProdMode()) { + System.err.println("Error while parsing json: " + e.getMessage() + ".\n" + json); + } return Properties.create(); } } -- 2.39.5