Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0038842Openbravo ERPZ. Otherspublic2018-06-26 16:402022-02-01 07:24
matias-bernal 
Triage Platform Base 
normalminoralways
newopen 
5
pi 
 
JSON Datasource
No
0038842: Exception occurs when converting JSON to Base OB Object when JSON contains "updated" property, and object is new
When using the Openbravo classes to convert JSON to BaseOBObject (JSONToDataConverter.java), you get an exception if the original JSON has an (non null) property with name: updated.

The problem is when the code checks the dates of the "current" object versus the one of the JSON, to avoid an update when the record has been updated by other process.
If the BaseOBObject is new, then the object's updated property is null (has not been set yet), then the validation between dates fails with a NPE.
1. Use JSON REST Webservices and send a POST to any writable entity, with all the required properties set (for example, Order).
2. Make sure your JSON has an "updated" field with a date.
3. Send the request.
4. An error should be returned by the web service: "Exception updating Order(null)". Logs show more detailed exceptions
5. Remove the "updated" property from the JSON.
6. Now the JSON should generate the entity properly.

Alternatively, create a simple class that makes use of the JsonToDataConverter, and tries to convert to BaseOBObject, a JSON with the updated property set.
Move the date validations after the updated property is set to the new object, or make sure that this validation is not done on new objects.
No tags attached.
Issue History
2018-06-26 16:40matias-bernalNew Issue
2018-06-26 16:40matias-bernalAssigned To => Triage Finance
2018-06-26 16:40matias-bernalModules => JSON Datasource
2018-06-26 16:40matias-bernalResolution time => 1532401200
2018-06-26 16:40matias-bernalTriggers an Emergency Pack => No
2018-06-26 16:41matias-bernalIssue Monitored: achaves
2018-06-26 16:42matias-bernalIssue Monitored: szapata
2018-07-25 17:18collazoandy4Assigned ToTriage Finance => collazoandy4
2018-08-06 14:48ngarciaResolution time1532401200 =>
2019-10-14 15:07SandrahuguetAssigned Tocollazoandy4 => Triage Finance
2019-12-19 13:18dmiguelezAssigned ToTriage Finance => platform
2022-02-01 07:24alostaleAssigned Toplatform => Triage Platform Base

There are no notes attached to this issue.