-
Notifications
You must be signed in to change notification settings - Fork 232
Add "serialVersionUID" for exceptions to avoid InvalidClassException #481
Conversation
Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #481 +/- ##
=========================================
Coverage 88.18% 88.18%
Complexity 495 495
=========================================
Files 64 64
Lines 1853 1853
Branches 241 241
=========================================
Hits 1634 1634
Misses 141 141
Partials 78 78
Continue to review full report at Codecov.
|
@quaff hi, can I ask you about your serialization use case? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I don't think we'll ever need to serialize the exception (or any other class in this client, for that matter), but, having a serial version UID for Exceptions is indeed a good practice. |
@jpkrohling It will used when perform RMI such as spring httpInvoker, exception will be serialized in server and deserialized in client, client rethrow it. |
@quaff thanks for the link. I am not asking why we should add serialization id, but how you are using jaeger client so you need the serialization. |
@pavolloffay I'm using spring httpinvoker as microservice implementation, It use java serialization by default, exceptions will propagated from server to client. |
Interesting. I wouldn't expect the client to be remotely called, or that an exception on the client library to propagate way back to a remote caller, but it would certainly make sense. I'm curious though: is this an actual scenario you faced, or is it theoretical? If you faced this issue, would you mind sharing more details (source code would be even better). We could then derive more tests from it (cc @jkandasa) |
The problem is not jaeger specific, but I'm using jaeger for demonstration
|
@jpkrohling It's not an actual scenario, I found it because eclipse reports warning, but I have faced same issue caused by missing serialVersionUID. |
Thanks @quaff ! |
Which problem is this PR solving?
avoid potential InvalidClassException when perform deserialization.
Short description of the changes
add generated serialVersionUID for exceptions.