Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Primitive array deserializer not being captured by DeserializerModifier #4216

Closed
1 task done
SakuraKoi opened this issue Nov 23, 2023 · 4 comments
Closed
1 task done
Labels
2.16 Issues planned for 2.16
Milestone

Comments

@SakuraKoi
Copy link

SakuraKoi commented Nov 23, 2023

Search before asking

  • I searched in the issues and found nothing similar.

Describe the bug

Since in createArrayDeserializer, primitive array deserializer is returned directly, the deserializer modifier is skipped and cannot capture these deserializers.

Version Information

2.16.0

Reproduction

public class Test {
    public byte[] field1;
    public Byte[] field2;
}

public void doTest() throws Exception {
    ObjectMapper objectMapper = new ObjectMapper();
    SimpleModule module = new SimpleModule();
    module.setDeserializerModifier(new BeanDeserializerModifier() {
        @Override
        public JsonDeserializer<?> modifyArrayDeserializer(DeserializationConfig config, ArrayType valueType, BeanDescription beanDesc, JsonDeserializer<?> deserializer) {
            // It will capture the deserializer for Test.field2 but not Test.field1
            return deserializer;
        }
    });
    objectMapper.registerModule(module);

    Test test = new Test();
    test.field1 = new byte[]{(byte)0x11};
    test.field2 = new Byte[]{(byte)0x11};
    String sample = objectMapper.writeValueAsString(test);

    objectMapper.readValue(sample, Test.class);
}

Expected behavior

both the deserializer for field1 and field2 got captured by DeserializerModifier in the sample code

Additional context

No response

@SakuraKoi SakuraKoi added the to-evaluate Issue that has been received but not yet evaluated label Nov 23, 2023
@cowtowncoder cowtowncoder added 2.16 Issues planned for 2.16 and removed to-evaluate Issue that has been received but not yet evaluated labels Nov 23, 2023
@cowtowncoder
Copy link
Member

Thank you for reporting this, @SakuraKoi . Definitely sounds like a bug, and reason you mentioned sounds accurate as well.

@cowtowncoder
Copy link
Member

I think fix should targeted to 2.16 branch, ideally for 2.16.1.

@JooHyukKim
Copy link
Member

Possible fix made by #4219, with update notes. Thank you for taking the time to analyze things, @SakuraKoi!

@cowtowncoder cowtowncoder changed the title Primitive array deserializer cannot being captured by DeserializerModifier Primitive array deserializer not being captured by DeserializerModifier Nov 26, 2023
cowtowncoder added a commit that referenced this issue Nov 26, 2023
@cowtowncoder cowtowncoder added this to the 2.16.1 milestone Nov 26, 2023
@cowtowncoder
Copy link
Member

Fixed via #4219. Thank you @JooHyukKim for the fix, @SakuraKoi for reporting this!

dongjoon-hyun pushed a commit to apache/spark that referenced this issue Dec 27, 2023
### What changes were proposed in this pull request?
This pr aims to upgrade jackson from 2.16.0 to 2.16.1

### Why are the changes needed?
The new version bring some fix:

- [#4200](FasterXML/jackson-databind#4200): JsonSetter(contentNulls = FAIL) is ignored in delegating JsonCreator argument
- [#4216](FasterXML/jackson-databind#4216): Primitive array deserializer not being captured by DeserializerModifier
- [#4219](FasterXML/jackson-databind#4219): JsonNode.findValues() and findParents() missing expected values in 2.16.0

The full release notes as follows:

- https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.16.1

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Pass Github Actions

### Was this patch authored or co-authored using generative AI tooling?
No

Closes #44494 from LuciferYang/SPARK-46508.

Authored-by: yangjie01 <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
szehon-ho pushed a commit to szehon-ho/spark that referenced this issue Aug 7, 2024
This pr aims to upgrade jackson from 2.16.0 to 2.16.1

The new version bring some fix:

- [apache#4200](FasterXML/jackson-databind#4200): JsonSetter(contentNulls = FAIL) is ignored in delegating JsonCreator argument
- [apache#4216](FasterXML/jackson-databind#4216): Primitive array deserializer not being captured by DeserializerModifier
- [apache#4219](FasterXML/jackson-databind#4219): JsonNode.findValues() and findParents() missing expected values in 2.16.0

The full release notes as follows:

- https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.16.1

No

Pass Github Actions

No

Closes apache#44494 from LuciferYang/SPARK-46508.

Authored-by: yangjie01 <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.16 Issues planned for 2.16
Projects
None yet
Development

No branches or pull requests

3 participants