From 7ea6f3b7d50f0bc1fdb318425bb8c2b731de5bf4 Mon Sep 17 00:00:00 2001 From: Vivek Ganesan Date: Mon, 21 Nov 2016 21:35:44 +0530 Subject: [PATCH] Non mandatory number fields can be set to null Fixes Issue https://github.com/rcarz/jira-client/issues/188 --- src/main/java/net/rcarz/jiraclient/Field.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/rcarz/jiraclient/Field.java b/src/main/java/net/rcarz/jiraclient/Field.java index 0101914..c33921a 100644 --- a/src/main/java/net/rcarz/jiraclient/Field.java +++ b/src/main/java/net/rcarz/jiraclient/Field.java @@ -726,7 +726,9 @@ public final class Field { else if (value instanceof TimeTracking) return ((TimeTracking) value).toJsonObject(); } else if (m.type.equals("number")) { - if(!(value instanceof java.lang.Integer) && !(value instanceof java.lang.Double) && !(value + if (value == null) //Non mandatory number fields can be set to null + return JSONNull.getInstance(); + else if(!(value instanceof java.lang.Integer) && !(value instanceof java.lang.Double) && !(value instanceof java.lang.Float) && !(value instanceof java.lang.Long) ) { throw new JiraException("Field '" + name + "' expects a Numeric value");