Is this a bug? Or my fault? [message #1834523] |
Wed, 11 November 2020 17:28 |
webi lon Messages: 3 Registered: November 2020 |
Junior Member |
|
|
File: Notifier.java
Line: request.setContent( DataMapperSelector.getDataMapperList().get( sub.getNotificationPayloadContentType() ).objToString(notification));
Produces:
Exception in thread "pool-1-thread-2" java.lang.NullPointerException
at org.eclipse.om2m.core.notifier.Notifier$NotificationWorker.run(Notifier.java:370)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Teste case:
1.Created a AE via mqtt (no problem)
2.Created a container, via mqtt, inside that AE (no problem)
3.Created a subscription (via mqtt) for that container (rr=true, poa=mqtt://...)
4.Created a content instance (via mqtt, using json payload) on the container and I see this log on mn-cse:
Exception in thread "pool-1-thread-2" java.lang.NullPointerException
at org.eclipse.om2m.core.notifier.Notifier$NotificationWorker.run(Notifier.java:370)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Here is the source code line:
request.setContent( DataMapperSelector.getDataMapperList().get( sub.getNotificationPayloadContentType() ).objToString(notification));
If I replace this line by something (just for testing purposes) like:
request.setContent("Blablabla");
and if I execute the same steps again then I get the notification via mqtt, of course with <pc>Blablabla</pc>
In this test case the sub.getNotificationPayloadContentType() returns "application/obj"
Then the get() method does not finds any entry for application/obj because there are just two entries for:
application/xml
application/json
So the request.setContent sets with null...
(By the way, MqttRequestHandler.java, messageArrived sets the primitiveContentype as MimeMediaType.OBJ, line 259)
(
If I also replace source code line (just for testing) by:
request.setContent( DataMapperSelector.getDataMapperList().get( "application/json" ).objToString(notification));
it works, and notification is delivered with success
)
Any help on this?
Thank you
lon
[Updated on: Wed, 11 November 2020 17:42] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03238 seconds