This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit e1b985f05c79117284ca99a238e41b01a16dd680 Author: Kevin Morin <morin@codelutin.com> Date: Thu Apr 13 17:48:45 2017 +0200 Conversion des chaines vides en Double null (pour les votes) --- .../src/main/java/org/chorem/pollen/rest/api/JsonHelper.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/JsonHelper.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/JsonHelper.java index 1afee10..b305dd5 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/JsonHelper.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/JsonHelper.java @@ -32,7 +32,7 @@ import com.google.gson.JsonNull; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializer; -import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.chorem.pollen.services.bean.PollenEntityId; import org.chorem.pollen.services.bean.PollenEntityRef; @@ -208,6 +208,16 @@ public class JsonHelper { }); + gsonBuilder.registerTypeAdapter(Double.class, (JsonDeserializer<Double>) (json, typeOfT, context) -> { + Double result; + if (StringUtils.isEmpty(json.getAsString())) { + result = null; + } else { + result = json.getAsDouble(); + } + return result; + }); + if (prettyPrint) { gsonBuilder.setPrettyPrinting(); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.