question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Afterburner does not support the new CoercionConfig

See original GitHub issue

I have a project which disables scalar coercion, however allows serialization and deserialization of java long, java.lang.Long, and java.util.OptionalLong values as strings to avoid javascript number truncation. Upgrading to 2.12.0 I replaced custom deserializers with CoercionConfig, however optimized accessors fail with:

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot coerce JSON VALUE_STRING value ("1") into long (enable `MapperFeature.ALLOW_COERCION_OF_SCALARS` to allow)
 at [Source: (String)"{"value":"1"}"; line: 1, column: 10]

	at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
	at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1603)
	at com.fasterxml.jackson.module.afterburner.deser.OptimizedSettableBeanProperty._verifyScalarCoercion(OptimizedSettableBeanProperty.java:405)
	at com.fasterxml.jackson.module.afterburner.deser.OptimizedSettableBeanProperty._deserializeLong(OptimizedSettableBeanProperty.java:305)
	at com.fasterxml.jackson.module.afterburner.deser.SettableLongMethodProperty.deserializeAndSet(SettableLongMethodProperty.java:40)
	at com.fasterxml.jackson.module.afterburner.deser.SuperSonicBeanDeserializer.deserialize(SuperSonicBeanDeserializer.java:159)
	at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:322)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4591)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3546)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3514)

The afterburner module should respect the CoercionConfig, currently it only checks MapperFeature.ALLOW_COERCION_OF_SCALARS: https://github.com/FasterXML/jackson-modules-base/blob/6876b282d56983cc0296dc1ce5346503d8bc11e6/afterburner/src/main/java/com/fasterxml/jackson/module/afterburner/deser/OptimizedSettableBeanProperty.java#L402-L413

Blackbird appears to be impacted as well (at a glance reading the code, I have not validated with a test yet): https://github.com/FasterXML/jackson-modules-base/blob/6876b282d56983cc0296dc1ce5346503d8bc11e6/blackbird/src/main/java/com/fasterxml/jackson/module/blackbird/deser/OptimizedSettableBeanProperty.java#L381-L392

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
cowtowncodercommented, Dec 17, 2020

Starting work on this, bigger than I thought but important to get parity.

0reactions
cowtowncodercommented, Dec 18, 2020

Ok I think this should work now. Did a sizable detour by first copying quite a bit of handling code from StdDeserializer, before realizing that I can delegate non-default input shapes and keep code not only much tighter but also more compliant (since delegating uses default databind handling in that case).

@carterkozak Would appreciate if you could see if snapshot from 2.12 works better at this point.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - Afterburner does not support the new CoercionConfig -
Coming soon: A brand new website interface for an even better experience!
Read more >
Jackson 2.12 Features - cowtowncoder - Medium
New Module: Blackbird. One commonly used performance enhancement drug for Jackson — Jackson Afterburner module — has been showing some signs of ...
Read more >
SettableBeanProperty.Delegating (jackson-databind 2.14.0 API)
Method called to assign given value to this property, on specified Object. Note: this is an optional operation, not supported by all implementations,...
Read more >
jackson-module-afterburner-2.13.3-1.5.noarch.rpm openSUSE ...
jackson-module-afterburner - Jackson module that uses byte-code ... #120: Afterburner does not support the new CoercionConfig + #123: BlackBird not support ...
Read more >
Serialized Form (jackson-databind 2.12.1 API) - javadoc.io
May be an interface or abstract class, so instantiation may not be possible. ... If null, a new instance is created, if non-null,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found