Summary: | StandardSession attempts to silently write NonSerializable objects | ||
---|---|---|---|
Product: | Tomcat 8 | Reporter: | Andrew Shore <shorea> |
Component: | Catalina | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 8.0.x-trunk | ||
Target Milestone: | ---- | ||
Hardware: | All | ||
OS: | All | ||
Attachments: | Patch for bug |
Description
Andrew Shore
2015-08-26 17:02:30 UTC
I've written some unit tests that confirm the behaviour you've reported. I'm currently leaning towards trying to implement what the current code appears to be trying to do which is to log a warning but to carry on. Thanks for the update! If I understand correctly the suggested change would be to do away with the NOT_SERIALIZED marker in StandardSession and rely on TC_EXCEPTION in ObjectOutputStream. In write object we would catch the NotSerializableException, log a warning, and carry on. In read object we would catch the WriteAbortedException (potentially with additional checks to make sure it's due to a NonSerializableException), log a warning, and carry on. Is my understanding correct? Exactly. Sounds good to me. Would you prefer I submit a patch for this? Patches are always welcome! Great, I'll get started on it. Thanks for the guidance. Any progress? Ping? I'm likely to be in a position to start the next 8.0.x release soon and this needs to be fixed before the tag. If no patch is forthcoming, I'll likely end up writing the patch myself. Hey sorry the the delay in response. I was out of the office last week and haven't had a chance to start this. How soon is soon? I probably won't be able to get to this until later in the week. You probably have a day or two. I'll update the bug when I reach the point where I need the patch. If you can update it as well when you start work we should be able to avoid duplicating effort. Will do. Thanks Mark. Created attachment 33114 [details]
Patch for bug
Had some test failures but I think it's my local setup. Could you run it through the test suite to make sure it's good.
Many thanks for the patch and the updated test case. I have applied it (with some very minor cosmetic changes) to trunk, 8.0.x (for 8.0.27 onwards) and 7.0.x (for 7.0.65 onwards). Fantastic. Thanks! |