Skip to content
Snippets Groups Projects
Commit d8e23a3f authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Bugfix: If empty JSON string: Set observationData = null to avoid

PostgreSQL protesting about erroneous JSON format.
parent d7bc43dc
No related branches found
No related tags found
No related merge requests found
...@@ -412,7 +412,11 @@ public class ObservationController extends HttpServlet { ...@@ -412,7 +412,11 @@ public class ObservationController extends HttpServlet {
observation.setObservationHeading(formValidation.getFormField("observationHeading").getWebValue()); observation.setObservationHeading(formValidation.getFormField("observationHeading").getWebValue());
observation.setObservationText(formValidation.getFormField("observationText").getWebValue()); observation.setObservationText(formValidation.getFormField("observationText").getWebValue());
observation.setObservationData(formValidation.getFormField("observationData").getWebValue()); observation.setObservationData(
formValidation.getFormField("observationData").getWebValue().isEmpty() ?
null
: formValidation.getFormField("observationData").getWebValue()
);
observation.setIsQuantified(formValidation.getFormField("isQuantified").getWebValue() != null); observation.setIsQuantified(formValidation.getFormField("isQuantified").getWebValue() != null);
observation.setLocationIsPrivate(formValidation.getFormField("locationIsPrivate").getWebValue() != null); observation.setLocationIsPrivate(formValidation.getFormField("locationIsPrivate").getWebValue() != null);
observation.setBroadcastMessage(formValidation.getFormField("broadcastMessage").getWebValue() != null); observation.setBroadcastMessage(formValidation.getFormField("broadcastMessage").getWebValue() != null);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment