Skip to content

Commit 868caf4

Browse files
committed
Tiny reordering of cases wrt #983 to start with likeliest
1 parent cfeeccb commit 868caf4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/main/java/com/fasterxml/jackson/core/JsonGenerator.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2492,12 +2492,12 @@ public void copyCurrentEvent(JsonParser p) throws IOException
24922492
case ID_NUMBER_FLOAT:
24932493
{
24942494
Number n = p.getNumberValueExact();
2495-
if (n instanceof Float) {
2496-
writeNumber((Float) n);
2497-
} else if (n instanceof BigDecimal) {
2495+
if (n instanceof BigDecimal) {
24982496
writeNumber((BigDecimal) n);
2499-
} else {
2497+
} else if (n instanceof Double) {
25002498
writeNumber(n.doubleValue());
2499+
} else {
2500+
writeNumber(n.floatValue());
25012501
}
25022502
break;
25032503
}
@@ -2637,12 +2637,12 @@ protected void _copyCurrentContents(JsonParser p) throws IOException
26372637
case ID_NUMBER_FLOAT:
26382638
{
26392639
Number n = p.getNumberValueExact();
2640-
if (n instanceof Float) {
2641-
writeNumber((Float) n);
2642-
} else if (n instanceof BigDecimal) {
2640+
if (n instanceof BigDecimal) {
26432641
writeNumber((BigDecimal) n);
2644-
} else {
2642+
} else if (n instanceof Double) {
26452643
writeNumber(n.doubleValue());
2644+
} else {
2645+
writeNumber(n.floatValue());
26462646
}
26472647
break;
26482648
}

0 commit comments

Comments
 (0)