New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeException when serializing nested class #37
Comments
Hi, I have done tweaks in the past to explicitely null the value of this$0 [by registering a custom serializer+using reflection], however this leads to NPE at receiver side once methods/fields of the outer class are accessed ofc. In order to make an inner class serializable, declare it static "static class ..". In case you need a ref to outer instance, define it explicitely and make it transient. You somehow need to set it then after deserialization. |
Hello, Thanks for your feedback, I'll apply the 'static' approach when it comes up again. I fixed this case using 'transient' variables since those giving the serializable error shouldn't have been serializing in the first place. Just fyi, we only got this error on that particular are once we switched from using 'ObjectOutputStream' to 'FSTObjectOutput' which means that there must be some subtle difference somehow. thanks |
"Just fyi, we only got this error on that particular are once we switched from using 'ObjectOutputStream' to 'FSTObjectOutput' which means that there must be some subtle difference somehow." Can you provide an reproducing example ?. I am not aware of a difference there and would like to find out. |
Btw, the newest 1.x builds are also 1.6 compliant |
Sure, I'll try to create something which resembles the composition we have On Mon, Nov 3, 2014 at 12:21 PM, RuedigerMoeller notifications@github.com
|
That would be great :-) |
Hello, Please find a test eclipse project here: https://github.com/jswaelens/testFST You can toggle the use of std serialization and fst in 'be.foo.bean.TestBean.doSomething()' by manipulating the boolean. Set it to false to use the standard object serialization and true to use FST. It seems to be triggered by having an abstract class with a non serializable sub-class - maybe it is some edge case? thanks! |
Awesome. Thanks a lot. As I'll be off to Goto 2014 it might take some days until I can check it out. |
No problem, glad to be able to help! On Tue Nov 04 2014 at 8:49:25 PM RuedigerMoeller notifications@github.com
|
Hm .. looks like a JDK bug to me on a first glance. I see there is an instance of a non-serializable class coming in and getting written .. BTW you should upgrade to 1.63 (some fixes). |
Yep, it is weird that it doesn't throw the not Serializable error indeed. On Tue, Nov 4, 2014, 21:18 RuedigerMoeller notifications@github.com wrote:
|
Its definitely a JDK bug. I was able to serialize a directbytebuffer. However the deserialized object had wrong values. Funny :-) https://github.com/RuedigerMoeller/fast-serialization/tree/master/src/test/jdk_bug/foo |
will create a new label 'jdk-bug' =) |
Ah, always nice to find a bug in the ye 'old JDK! Do you want me to log it On Wed Nov 05 2014 at 1:40:16 AM RuedigerMoeller notifications@github.com
|
you found it, so just let me know if you want to report it. In case you don't I will do .. |
Okey, submitted - I'll keep you posted ;-) On Wed Nov 05 2014 at 10:08:46 AM RuedigerMoeller notifications@github.com
|
Hello,
I am getting an error when I serialize a private nested class, because its parent (the one where the inner class is defined in) is not serializable. I was not expecting that the parent class would also be serialized, this seems a bit odd ... and possible not intended? Moving the particular class to its own type resolved the issue, but we might have more cases like this yet to be detected.
This is on version 1.55 (JRE 6 compatible version).
Please advise on the best way to proceed.
thanks!
The text was updated successfully, but these errors were encountered: