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

Fix NPE hashcode in LwM2mPath #1505

Merged
merged 3 commits into from
Sep 1, 2023
Merged

Fix NPE hashcode in LwM2mPath #1505

merged 3 commits into from
Sep 1, 2023

Conversation

sbernard31
Copy link
Contributor

This aims to fix NullPointerException in LwM2mPath.hashcode() when objectId is null

java.lang.NullPointerException: null
	at org.eclipse.leshan.core.node.LwM2mPath.hashCode(LwM2mPath.java:336)
	at java.util.HashMap.hash(HashMap.java:339)
	at java.util.HashMap.put(HashMap.java:612)
	at org.eclipse.leshan.core.node.codec.senml.LwM2mNodeSenMLDecoder.groupByPath(LwM2mNodeSenMLDecoder.java:322)
	at org.eclipse.leshan.core.node.codec.senml.LwM2mNodeSenMLDecoder.decodeNodes(LwM2mNodeSenMLDecoder.java:130)
	at org.eclipse.leshan.core.node.codec.DefaultLwM2mDecoder.decodeNodes(DefaultLwM2mDecoder.java:178)
	at org.eclipse.leshan.server.californium.request.LwM2mResponseBuilder.decodeCompositeCoapResponse(LwM2mResponseBuilder.java:506)
	at org.eclipse.leshan.server.californium.request.LwM2mResponseBuilder.visit(LwM2mResponseBuilder.java:307)
	at org.eclipse.leshan.core.request.ReadCompositeRequest.accept(ReadCompositeRequest.java:105)
	at org.eclipse.leshan.server.californium.endpoint.ServerCoapMessageTranslator.createLwM2mResponse(ServerCoapMessageTranslator.java:75)
	at org.eclipse.leshan.server.californium.endpoint.CaliforniumServerEndpoint$1.buildResponse(CaliforniumServerEndpoint.java:111)
	at org.eclipse.leshan.core.californium.SyncRequestObserver.waitForResponse(SyncRequestObserver.java:55)
	at org.eclipse.leshan.server.californium.endpoint.CaliforniumServerEndpoint.send(CaliforniumServerEndpoint.java:137)
	at org.eclipse.leshan.server.request.DefaultDownlinkRequestSender.send(DefaultDownlinkRequestSender.java:93)
	at org.eclipse.leshan.server.queue.QueueModeLwM2mRequestSender.send(QueueModeLwM2mRequestSender.java:60)
	at org.eclipse.leshan.server.LeshanServer.send(LeshanServer.java:467)
	at org.eclipse.leshan.server.LeshanServer.send(LeshanServer.java:440)

From : #1502

The equals/hashcode implementation does not really support well inheritance but we should decide what is the right way to follow first : #1504

@sbernard31 sbernard31 merged commit 2281443 into master Sep 1, 2023
1 check passed
sbernard31 added a commit that referenced this pull request Sep 1, 2023
@sbernard31 sbernard31 deleted the fix_hashcode branch September 25, 2023 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant