Skip to content

Commit 404d148

Browse files
committed
Merge branch '2.13' into 2.14
2 parents 568dfbe + e2b89a8 commit 404d148

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

release-notes/VERSION-2.x

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Project: jackson-databind
44
=== Releases ===
55
------------------------------------------------------------------------
66

7+
2.14.3 (not yet released)
8+
9+
#3784: `PrimitiveArrayDeserializers$ByteDeser.deserialize` ignores
10+
`DeserializationProblemHandler` for invalid Base64 content
11+
712
2.14.2 (28-Jan-2023)
813

914
#1751: `@JsonTypeInfo` does not work if the Type Id is an Integer value

src/main/java/com/fasterxml/jackson/databind/deser/std/PrimitiveArrayDeserializers.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import com.fasterxml.jackson.core.*;
1212
import com.fasterxml.jackson.core.exc.StreamReadException;
13+
1314
import com.fasterxml.jackson.databind.*;
1415
import com.fasterxml.jackson.databind.annotation.JacksonStdImpl;
1516
import com.fasterxml.jackson.databind.deser.ContextualDeserializer;
@@ -467,7 +468,7 @@ public byte[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOEx
467468
if (t == JsonToken.VALUE_STRING) {
468469
try {
469470
return p.getBinaryValue(ctxt.getBase64Variant());
470-
} catch (StreamReadException e) {
471+
} catch (StreamReadException | DatabindException e) {
471472
// 25-Nov-2016, tatu: related to [databind#1425], try to convert
472473
// to a more usable one, as it's not really a JSON-level parse
473474
// exception, but rather binding from JSON String into base64 decoded

src/test/java/com/fasterxml/jackson/databind/deser/filter/ProblemHandlerTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,22 @@ public void testWeirdStringHandling() throws Exception
271271
assertNull(result2);
272272
}
273273

274+
// [databind#3784]: Base64 decoding
275+
public void testWeirdStringForBase64() throws Exception
276+
{
277+
ObjectMapper mapper = newJsonMapper()
278+
.addHandler(new WeirdStringHandler(new byte[0]))
279+
;
280+
byte[] binary = mapper.readValue(q("foobar"), byte[].class);
281+
assertNotNull(binary);
282+
assertEquals(0, binary.length);
283+
284+
JsonNode tree = mapper.readTree(q("foobar"));
285+
binary = mapper.treeToValue(tree, byte[].class);
286+
assertNotNull(binary);
287+
assertEquals(0, binary.length);
288+
}
289+
274290
public void testInvalidTypeId() throws Exception
275291
{
276292
ObjectMapper mapper = newJsonMapper()

0 commit comments

Comments
 (0)