Skip to content

Commit c77e7e7

Browse files
committed
Fix #112: make custom serialization work for java.nio.file.Path
1 parent eff22a2 commit c77e7e7

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/ValueLocatorBase.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -236,21 +236,21 @@ protected int _findSimpleType(Class<?> raw, boolean forSer)
236236
if (UUID.class.isAssignableFrom(raw)) {
237237
return SER_UUID;
238238
}
239-
/* May or may not help with deser, but recognized nonetheless;
240-
* on assumption that Beans should rarely implement `CharSequence`
241-
*/
239+
// May or may not help with deser, but recognized nonetheless;
240+
// on assumption that Beans should rarely implement `CharSequence`
242241
if (CharSequence.class.isAssignableFrom(raw)) {
243242
return SER_CHARACTER_SEQUENCE;
244243
}
245-
/* `Iterable` can be added on all kinds of things, and it won't
246-
* help at all with deserialization; hence only use for serialization.
247-
*/
244+
// `Iterable` can be added on all kinds of things, and it won't
245+
// help at all with deserialization; hence only use for serialization.
248246
if (forSer && Iterable.class.isAssignableFrom(raw)) {
249-
return SER_ITERABLE;
247+
// 16-Feb-2024, tatu: [jackson-jr#112] java.nio.file.Path is not really Iterable
248+
if (!java.nio.file.Path.class.isAssignableFrom(raw)) {
249+
return SER_ITERABLE;
250+
}
250251
}
251252

252253
// Ok. I give up, no idea!
253254
return SER_UNKNOWN;
254255
}
255-
256256
}

jr-objects/src/test/java/com/fasterxml/jackson/jr/failing/ValueWriterModifier112Test.java renamed to jr-objects/src/test/java/com/fasterxml/jackson/jr/ob/impl/ValueWriterModifier112Test.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.fasterxml.jackson.jr.failing;
1+
package com.fasterxml.jackson.jr.ob.impl;
22

33
import java.io.File;
44
import java.io.IOException;

release-notes/CREDITS-2.x

+6
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ Reed Passaretti (@reed53)
3333

3434
* Reported #107: Cannot deserialize `byte[]` from JSON `null` value
3535
(2.15.3)
36+
37+
Julian Honnen (@jhonnen)
38+
39+
* Reported #112: `overrideStandardValueWriter` only applied to first `java.nio.file.Path`
40+
valued field of bean
41+
(2.17.0)

release-notes/VERSION-2.x

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ Modules:
1515

1616
#78: Deserializes "null" to "0.0" for `java.lang.Double` (wrapper)
1717
(reported by @bill-phast)
18+
#112: `overrideStandardValueWriter` only applied to first `java.nio.file.Path`
19+
valued field of bean
20+
(reported by Julian H)
1821

1922
2.16.1 (24-Dec-2023)
2023

0 commit comments

Comments
 (0)