Skip to content

Commit

Permalink
finatra-jackson: Update FieldInjection to catch ValueInstantiationExc…
Browse files Browse the repository at this point in the history
…eption

Problem/Solution

Update `c.t.finatra.json.internal.caseclass.utils.FieldInjection`
to also catch `ValueInstantiationException` due to
FasterXML/jackson-databind#2126.

Differential Revision: https://phabricator.twitter.biz/D407296
  • Loading branch information
cacoco authored and jenkins committed Dec 3, 2019
1 parent e9e5d4e commit 3d5050f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Unreleased
Changed
~~~~~~~

* finatra-jackson: Update `c.t.finatra.json.internal.caseclass.utils.FieldInjection`
to also catch `ValueInstantiationException` due to
https://github.com/FasterXML/jackson-databind/issues/2126. ``PHAB_ID=D407296``

* finatra-http: Remove deprecated `c.t.finatra.http.HttpHeaders`. Users should use
`com.twitter.finagle.http.Fields` instead. ``PHAB_ID=D407290``

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.twitter.finatra.json.internal.caseclass.utils

import com.fasterxml.jackson.core.ObjectCodec
import com.fasterxml.jackson.databind.deser.impl.ValueInjector
import com.fasterxml.jackson.databind.exc.InvalidDefinitionException
import com.fasterxml.jackson.databind.exc.{InvalidDefinitionException, ValueInstantiationException}
import com.fasterxml.jackson.databind.{DeserializationContext, JavaType, PropertyName}
import com.google.inject.{BindingAnnotation, ConfigurationException, Key}
import com.twitter.finagle.http.Request
Expand Down Expand Up @@ -68,7 +68,7 @@ private[json] class FieldInjection(
try {
Option(context.findInjectableValue(guiceKey, beanProperty, /* beanInstance = */ null))
} catch {
case _: InvalidDefinitionException =>
case _: InvalidDefinitionException | _: ValueInstantiationException =>
throw JsonInjectionNotSupportedException(parentClass, name)
case e: ConfigurationException =>
throw JsonInjectException(parentClass, name, guiceKey, e)
Expand Down

0 comments on commit 3d5050f

Please sign in to comment.