From 6def77cfd6e45dad68e25d3baf3486c952505f3f Mon Sep 17 00:00:00 2001 From: Kevin Daub <1937187+kevindaub@users.noreply.github.com> Date: Sun, 7 Apr 2019 21:29:13 -0400 Subject: [PATCH] Fix #336 Fixed usage of WRITE_BIGDECIMAL_AS_PLAIN when XML pretty printer is configured. --- .../jackson/dataformat/xml/ser/ToXmlGenerator.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/dataformat/xml/ser/ToXmlGenerator.java b/src/main/java/com/fasterxml/jackson/dataformat/xml/ser/ToXmlGenerator.java index 053a967cd..f5982052e 100644 --- a/src/main/java/com/fasterxml/jackson/dataformat/xml/ser/ToXmlGenerator.java +++ b/src/main/java/com/fasterxml/jackson/dataformat/xml/ser/ToXmlGenerator.java @@ -1123,9 +1123,15 @@ public void writeNumber(BigDecimal dec) throws IOException } } else { if (_xmlPrettyPrinter != null) { - _xmlPrettyPrinter.writeLeafElement(_xmlWriter, - _nextName.getNamespaceURI(), _nextName.getLocalPart(), - dec); + if (usePlain) { + _xmlPrettyPrinter.writeLeafElement(_xmlWriter, + _nextName.getNamespaceURI(), _nextName.getLocalPart(), + dec.toPlainString(), false); + } else { + _xmlPrettyPrinter.writeLeafElement(_xmlWriter, + _nextName.getNamespaceURI(), _nextName.getLocalPart(), + dec); + } } else { _xmlWriter.writeStartElement(_nextName.getNamespaceURI(), _nextName.getLocalPart()); if (usePlain) {