diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-12-19 08:01:20 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-12-19 08:01:20 +1300 |
commit | 54e738d3281a463a0ea3fcf2026c2464529a9b58 (patch) | |
tree | 65e924f480d6489a5939d2f289c354240fd68e59 /src/org/traccar/web/CsvBuilder.java | |
parent | 99f09134fb9c710114296d603c97a76f5cfb0d2a (diff) | |
download | trackermap-server-54e738d3281a463a0ea3fcf2026c2464529a9b58.tar.gz trackermap-server-54e738d3281a463a0ea3fcf2026c2464529a9b58.tar.bz2 trackermap-server-54e738d3281a463a0ea3fcf2026c2464529a9b58.zip |
Remove own JSON converter
Diffstat (limited to 'src/org/traccar/web/CsvBuilder.java')
-rw-r--r-- | src/org/traccar/web/CsvBuilder.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/org/traccar/web/CsvBuilder.java b/src/org/traccar/web/CsvBuilder.java index 532f06e3d..31b389873 100644 --- a/src/org/traccar/web/CsvBuilder.java +++ b/src/org/traccar/web/CsvBuilder.java @@ -27,11 +27,12 @@ import java.util.Map; import java.util.SortedSet; import java.util.TreeSet; +import com.fasterxml.jackson.core.JsonProcessingException; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.ISODateTimeFormat; +import org.traccar.Context; import org.traccar.helper.Log; -import org.traccar.model.MiscFormatter; public class CsvBuilder { @@ -95,11 +96,15 @@ public class CsvBuilder { } else if (method.getReturnType().equals(Map.class)) { Map value = (Map) method.invoke(object); if (value != null) { - String map = MiscFormatter.toJson(value).toString(); - map = map.replaceAll("[\\{\\}\"]", ""); - map = map.replaceAll(",", " "); - builder.append(map); - addSeparator(); + try { + String map = Context.getObjectMapper().writeValueAsString(value); + map = map.replaceAll("[\\{\\}\"]", ""); + map = map.replaceAll(",", " "); + builder.append(map); + addSeparator(); + } catch (JsonProcessingException e) { + Log.warning(e); + } } } } catch (IllegalAccessException | InvocationTargetException error) { |