Skip to content

Make FeignException truly serializable #1193

Closed

Description

@nikolas-charalambidis

The class FeignException implements Serializable inherited from the Exception hierarchy, however, it contains the object feign.Request which is not Serializable itself, therefore further serialization into either JSON or Camunda process variable is impossible (my case), etc...

Is possible to either change the internals of feign.Request to be serializable itself or amend FeignException to hold information about the failed request in another way?

Version: 10.4.0

Activity

  1. added
    enhancement
    proposal
    on Mar 29, 2020
  2. kdavisk6 commented on Mar 29, 2020

    @kdavisk6
    Member

    @nikolas-charalambidis

    I think we would ok with either option. The simplest would be to investigate what it would take to make Request Serializable. Would you be willing to look into that for us?

  3. nikolas-charalambidis commented on Mar 30, 2020

    @nikolas-charalambidis
    ContributorAuthor

    I have already looked into the internals of feign.Request (and its feign.template.Template) which use objects right from JDK such as java.nio.charset.Charset that is not Serializable itself...

    I think there are two ways:

    1. Make Request as transient in the FeignException.
    2. Make Request implement Serializable and all instance field classes Serializable/transient.

    The object can never be fully Serializable when it uses java.nio.charset.Charset as an instance field internally.

    Edit: I can make a pull-request, but I'd like to discuss the best way to go first.

  4. kdavisk6 commented on Apr 6, 2020

    @kdavisk6
    Member

    @nikolas-charalambidis

    I think it's reasonable enough for us to change the charset instance variable type, so long as the method interfaces don't change. Are there any other instance variables that pose a problem?

  5. nikolas-charalambidis commented on Apr 11, 2020

    @nikolas-charalambidis
    ContributorAuthor

    @kdavisk6

    I have noticed no more problematic classes aside from java.nio.charset.Charset. We can substitute it with either a String literal or an enumeration from which we would be able to construct Charset where needed and keeping the interfaces untouched. If I propose a pull request, would you check it up?

  6. added a commit that references this issue on Sep 24, 2020
  7. kdavisk6 commented on Dec 29, 2020

    @kdavisk6
    Member

    Closed via #1262

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementproposal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions