Skip to content

Commit

Permalink
Merge pull request #115 from FasterXML/tatu/2.17/112-path-custom-seri…
Browse files Browse the repository at this point in the history
…alizer

Fix #112: make custom serialization work for `java.nio.file.Path`
  • Loading branch information
cowtowncoder authored Feb 17, 2024
2 parents eff22a2 + c77e7e7 commit 4486d21
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,21 +236,21 @@ protected int _findSimpleType(Class<?> raw, boolean forSer)
if (UUID.class.isAssignableFrom(raw)) {
return SER_UUID;
}
/* May or may not help with deser, but recognized nonetheless;
* on assumption that Beans should rarely implement `CharSequence`
*/
// May or may not help with deser, but recognized nonetheless;
// on assumption that Beans should rarely implement `CharSequence`
if (CharSequence.class.isAssignableFrom(raw)) {
return SER_CHARACTER_SEQUENCE;
}
/* `Iterable` can be added on all kinds of things, and it won't
* help at all with deserialization; hence only use for serialization.
*/
// `Iterable` can be added on all kinds of things, and it won't
// help at all with deserialization; hence only use for serialization.
if (forSer && Iterable.class.isAssignableFrom(raw)) {
return SER_ITERABLE;
// 16-Feb-2024, tatu: [jackson-jr#112] java.nio.file.Path is not really Iterable
if (!java.nio.file.Path.class.isAssignableFrom(raw)) {
return SER_ITERABLE;
}
}

// Ok. I give up, no idea!
return SER_UNKNOWN;
}

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

import java.io.File;
import java.io.IOException;
Expand Down
6 changes: 6 additions & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ Reed Passaretti (@reed53)

* Reported #107: Cannot deserialize `byte[]` from JSON `null` value
(2.15.3)

Julian Honnen (@jhonnen)

* Reported #112: `overrideStandardValueWriter` only applied to first `java.nio.file.Path`
valued field of bean
(2.17.0)
3 changes: 3 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Modules:

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

2.16.1 (24-Dec-2023)

Expand Down

0 comments on commit 4486d21

Please sign in to comment.