Skip to content
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

Using xStream_1_4_20, Not able to convert AtomicReference atomicRef = new AtomicReference(); with default value. It is giving NullpointerException. #326

Closed
ajaysharma2 opened this issue Feb 22, 2023 · 1 comment
Assignees
Labels
Milestone

Comments

@ajaysharma2
Copy link

ajaysharma2 commented Feb 22, 2023

It should handle NullpointerException
https://github.com/x-stream/xstream/blob/master/xstream/src/java/com/thoughtworks/xstream/converters/extended/AtomicReferenceConverter.java#L48

@ajaysharma2
Copy link
Author

Issue can be tested with existing test case by adding AtomicReference atomicRef = new AtomicReference()
https://github.com/x-stream/xstream/blob/master/xstream/src/test/com/thoughtworks/acceptance/ConcurrentTypesTest.java#L101

Current Class for converter lookup...java.util.concurrent.atomic.AtomicReference cachedConverter .... null marshal source ..... null marshal source getting object .....ref.get() null Exception occured .... null ... null java.lang.NullPointerException at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:50) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:44) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87) at com.thoughtworks.xstream.converters.extended.AtomicReferenceConverter.marshal(AtomicReferenceConverter.java:50) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:60) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:44) at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:89) at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37) at com.thoughtworks.xstream.XStream.marshal(XStream.java:1303) at com.thoughtworks.xstream.XStream.marshal(XStream.java:1292) at com.thoughtworks.xstream.XStream.toXML(XStream.java:1265) at com.thoughtworks.xstream.XStream.toXML(XStream.java:1252) at com.thoughtworks.acceptance.AbstractAcceptanceTest.toXML(AbstractAcceptanceTest.java:190) at com.thoughtworks.acceptance.AbstractAcceptanceTest.assertBothWays(AbstractAcceptanceTest.java:102) at com.thoughtworks.acceptance.Concurrent15TypesTest.testAtomicReference(Concurrent15TypesTest.java:107) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118)

ablekhman added a commit to atlassian-forks/xstream that referenced this issue Mar 28, 2023
@joehni joehni closed this as completed in 6444f7a Sep 22, 2023
@joehni joehni self-assigned this Sep 22, 2023
@joehni joehni added the bug label Sep 22, 2023
@joehni joehni added this to the 1.4.x milestone Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants