Source:
<code>private void setStatementParameters( ObjectNode jsonObject, Table table, PreparedStatement preparedStatement, Connection connection ) throws SQLException { List<String> missingFieldNames = new ArrayList<>(); int index = 1; for (Field field : table.editorFields()) { if (!jsonObject.has(field.name)) { missingFieldNames.add(field.name); continue; } JsonNode value = jsonObject.get(field.name); LOG.debug("{}={}", field.name, value); try { if (value == null || value.isNull()) { if (field.isRequired() && !field.isEmptyValuePermitted()) { missingFieldNames.add(field.name); continue; } field.setNull(preparedStatement, index); } else { if (value.isArray()) { List<String> values = new ArrayList<>(); for (JsonNode node : value) { values.add(node.asText()); } field.setParameter(preparedStatement, index, String.join(",", values)); } else { String text = value.asText(); if (text.isEmpty()) { <START> jsonObject.set(field.name, null); <END> field.setNull(preparedStatement, index); } else { field.setParameter(preparedStatement, index, text); } } } } catch (StorageException e) { LOG.warn("Could not set field to value {}. Attempting to parse integer seconds.", field.name, value); if (field.name.contains("_time")) { try { if (value == null || value.isNull()) { if (field.isRequired()) { missingFieldNames.add(field.name); continue; } field.setNull(preparedStatement, index); } else { preparedStatement.setInt(index, Integer.parseInt(value.asText())); LOG.info("Parsing value for field successful!", value, field.name); } } catch (NumberFormatException ex) { connection.rollback(); LOG.error("Bad column: {}={}", field.name, value); ex.printStackTrace(); throw ex; } } else { connection.rollback(); throw e; } } index += 1; } if (missingFieldNames.size() > 0) { throw new SQLException( String.format( "The following field(s) are missing from JSON %s object: %s", table.name, missingFieldNames.toString() ) ); } }</code><technical_language>jsonObject.set(field.name, null); added statements line 418-419</technical_language>

Target:
private void setStatementParameters( ObjectNode jsonObject, Table table, PreparedStatement preparedStatement, Connection connection ) throws SQLException { List<String> missingFieldNames = new ArrayList<>(); int index = 1; for (Field field : table.editorFields()) { if (!jsonObject.has(field.name)) { missingFieldNames.add(field.name); continue; } JsonNode value = jsonObject.get(field.name); LOG.debug("{}={}", field.name, value); try { if (value == null || value.isNull()) { if (field.isRequired() && !field.isEmptyValuePermitted()) { missingFieldNames.add(field.name); continue; } setFieldToNullAndUpdateJson(preparedStatement, jsonObject, field, index); } else { if (value.isArray()) { List<String> values = new ArrayList<>(); for (JsonNode node : value) { values.add(node.asText()); } field.setParameter(preparedStatement, index, String.join(",", values)); } else { String text = value.asText(); if (text.isEmpty()) { setFieldToNullAndUpdateJson(preparedStatement, jsonObject, field, index); } else { field.setParameter(preparedStatement, index, text); } } } } catch (StorageException e) { LOG.warn("Could not set field to value {}. Attempting to parse integer seconds.", field.name, value); if (field.name.contains("_time")) { try { if (value == null || value.isNull()) { if (field.isRequired()) { missingFieldNames.add(field.name); continue; } field.setNull(preparedStatement, index); } else { preparedStatement.setInt(index, Integer.parseInt(value.asText())); LOG.info("Parsing value for field successful!", value, field.name); } } catch (NumberFormatException ex) { connection.rollback(); LOG.error("Bad column: {}={}", field.name, value); ex.printStackTrace(); throw ex; } } else { connection.rollback(); throw e; } } index += 1; } if (missingFieldNames.size() > 0) { throw new SQLException( String.format( "The following field(s) are missing from JSON %s object: %s", table.name, missingFieldNames.toString() ) ); } }