details: https://code.openbravo.com/erp/devel/pi/rev/cf082b976da9
changeset: 19640:cf082b976da9
user: Augusto Mauch <augusto.mauch <at> openbravo.com>
date: Mon Feb 11 17:44:28 2013 +0100
summary: Fixes issue 22971: Columns with null values can be exported to CSV
The problem was that the convertPrimitiveValue method of the
DataToJsonConverter class was returning null when a null object was provided.
If then that null object is used in the JSONObject.put(key, value) in the value
field, the field was not added at all.
This has been fixed by returning an empty string instead of a null object.
diffstat:
modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
| 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diffs (15 lines):
diff -r 1f39c81dc9b9 -r cf082b976da9
modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
---
a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
Mon Feb 11 17:35:08 2013 +0100
+++
b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
Mon Feb 11 17:44:28 2013 +0100
@@ -322,7 +322,10 @@
protected Object convertPrimitiveValue(Object value) {
if (value == null) {
- return null;
+ // Do not return null, or they key and value of this particular column
will
+ // not be added to the JSON object
+ // See issue https://issues.openbravo.com/view.php?id=22971
+ return "";
}
if (value instanceof Date) {
return xmlDateFormat.format(value);
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits