/** * Initialises the value tuple. * * @param type * @param value */ public ValueTuple(String type, Object value) { this.type = type; this.value = (value != null ? value : JSONNull.getInstance()); }
writer.write(JSONNull.getInstance().toString()); return;
} else if (response==null) { JSONNull.getInstance().write(w); } else if (response instanceof Throwable) {
@SuppressWarnings({"unchecked"}) @Override public boolean configure(StaplerRequest req, JSONObject o) throws FormException { boolean useCredentialsPlugin = (Boolean)o.get("useCredentialsPlugin"); Object servers = o.get("artifactoryServer"); // an array or single object List<ArtifactoryServer> artifactoryServers; if (!JSONNull.getInstance().equals(servers)) { artifactoryServers = req.bindJSONToList(ArtifactoryServer.class, servers); } else { artifactoryServers = null; } if (!isServerIDConfigured(artifactoryServers)) { throw new FormException("Please set the Artifactory server ID.", "ServerID"); } if (isServerDuplicated(artifactoryServers)) { throw new FormException("The Artifactory server ID you have entered is already configured", "Server ID"); } setArtifactoryServers(artifactoryServers); if (useCredentialsPlugin && !this.useCredentialsPlugin) { resetJobsCredentials(); resetServersCredentials(); } this.useCredentialsPlugin = useCredentialsPlugin; save(); return super.configure(req, o); }
writer.write(JSONNull.getInstance().toString()); return;
} else if (response==null) { JSONNull.getInstance().write(w); } else if (response instanceof Throwable) {
/** * Initialises the value tuple. * * @param type * @param value */ public ValueTuple(String type, Object value) { this.type = type; this.value = (value != null ? value : JSONNull.getInstance()); }
writer.write(JSONNull.getInstance().toString()); return;
public ValueTuple(String type, Object value) { this.type = type; this.value = (value != null ? value : JSONNull.getInstance()); } public ValueTuple(ValueType type, Object value) {
writer.write(JSONNull.getInstance().toString()); return;
public Object toJSONObject(Object obj) { if (obj instanceof Map) { Map m = (Map) obj; JSONObject json = new JSONObject(); Iterator it = m.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); json.put((String) entry.getKey(), toJSONObject(entry.getValue())); } return json; } else if (obj instanceof Collection) { Collection col = (Collection) obj; JSONArray json = new JSONArray(); Iterator it = col.iterator(); while (it.hasNext()) { json.add(toJSONObject(it.next())); } return json; } else if (obj instanceof Number) { return obj; } else if (obj == null) { return JSONNull.getInstance(); } else { return obj.toString(); } }
} else if (m.type.equals("date")) { if (value == null) return JSONNull.getInstance(); } else if (m.type.equals("datetime")) { if (value == null) return JSONNull.getInstance(); else if (!(value instanceof Timestamp)) throw new BentenJiraException("Field '" + name + "' expects a Timestamp value"); return JSONNull.getInstance(); else if (value instanceof ValueTuple) { ValueTuple tuple = (ValueTuple)value; return JSONNull.getInstance(); else if (value instanceof ValueTuple) { ValueTuple tuple = (ValueTuple)value; } else if (m.type.equals("number")) { 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) ) } else if (m.type.equals("any")) { if (value == null) return JSONNull.getInstance(); else if (value instanceof List) return toJsonMap((List)value);
} else if (m.type.equals("date")) { if (value == null) return JSONNull.getInstance(); } else if (m.type.equals("datetime")) { if (value == null) return JSONNull.getInstance(); else if (!(value instanceof Timestamp)) throw new JiraException("Field '" + name + "' expects a Timestamp value"); return JSONNull.getInstance(); else if (value instanceof ValueTuple) { ValueTuple tuple = (ValueTuple)value; return JSONNull.getInstance(); else if (value instanceof ValueTuple) { ValueTuple tuple = (ValueTuple)value; } else if (m.type.equals("timetracking")) { if (value == null) return JSONNull.getInstance(); else if (value instanceof TimeTracking) return ((TimeTracking) value).toJsonObject(); } else if (m.type.equals("number")) { 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) )
} else if (m.type.equals("date")) { if (value == null) return JSONNull.getInstance(); } else if (m.type.equals("datetime")) { if (value == null) return JSONNull.getInstance(); else if (!(value instanceof Timestamp)) throw new JiraException("Field expects a Timestamp value"); return JSONNull.getInstance(); else if (value instanceof ValueTuple) { ValueTuple tuple = (ValueTuple)value; return JSONNull.getInstance(); else if (value instanceof ValueTuple) { ValueTuple tuple = (ValueTuple)value; } else if (m.type.equals("timetracking")) { if (value == null) return JSONNull.getInstance(); else if (value instanceof TimeTracking) return ((TimeTracking) value).toJsonObject();
return obj; } else if (obj == null) { return JSONNull.getInstance(); } else { return obj.toString();
return JSONNull.getInstance(); } else { return JSONSerializer.toJSON(response, new JsonConfig());
@Test public void testGetBranchWithEmptyResponse() throws Exception { JSONObject empty = new JSONObject(); empty.put("branch", JSONNull.getInstance()); Differential diff = new Differential(empty); assertEquals("(none)", diff.getBranch()); }
assertEquals(JSONNull.getInstance(), bbox); } finally { wfs.setFeatureBounding(before);