5
5
import java .math .BigInteger ;
6
6
7
7
import com .fasterxml .jackson .core .*;
8
+ import com .fasterxml .jackson .core .JsonGenerator .Feature ;
8
9
import com .fasterxml .jackson .core .io .*;
9
10
10
11
public class UTF8JsonGenerator
@@ -844,7 +845,7 @@ public void writeNumber(BigInteger value)
844
845
if (value == null ) {
845
846
_writeNull ();
846
847
} else if (_cfgNumbersAsStrings ) {
847
- _writeQuotedRaw (value );
848
+ _writeQuotedRaw (value . toString () );
848
849
} else {
849
850
writeRaw (value .toString ());
850
851
}
@@ -892,7 +893,8 @@ public void writeNumber(BigDecimal value)
892
893
if (value == null ) {
893
894
_writeNull ();
894
895
} else if (_cfgNumbersAsStrings ) {
895
- _writeQuotedRaw (value );
896
+ String raw = isEnabled (Feature .WRITE_BIGDECIMAL_AS_PLAIN ) ? value .toPlainString () : value .toString ();
897
+ _writeQuotedRaw (raw );
896
898
} else if (isEnabled (Feature .WRITE_BIGDECIMAL_AS_PLAIN )) {
897
899
writeRaw (value .toPlainString ());
898
900
} else {
@@ -912,13 +914,13 @@ public void writeNumber(String encodedValue)
912
914
}
913
915
}
914
916
915
- private final void _writeQuotedRaw (Object value ) throws IOException
917
+ private final void _writeQuotedRaw (String value ) throws IOException
916
918
{
917
919
if (_outputTail >= _outputEnd ) {
918
920
_flushBuffer ();
919
921
}
920
922
_outputBuffer [_outputTail ++] = BYTE_QUOTE ;
921
- writeRaw (value . toString () );
923
+ writeRaw (value );
922
924
if (_outputTail >= _outputEnd ) {
923
925
_flushBuffer ();
924
926
}
0 commit comments