Bug #2773
Internal invoke nullpointer not handeled.
Status: | Resolved | Start date: | 10/17/2018 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | J. Wienke | % Done: | 100% | |
Category: | Java | |||
Target version: | rsb-0.18 |
Description
error nullpointer not handeled.
setup spread configured via global config file but no spread started.
test code snipped:
server.addMethod("mymethod", new Callback() { @Override public Event internalInvoke(Event request) throws UserCodeException { System.out.println("process task"); try { Thread.sleep(10000); } catch (InterruptedException ex) { System.out.println("interrupt task"); throw new UserCodeException(ex); } return null; // <-- this causes the nullpointer which maybe should be handeled } });
output
Exception in thread "Thread-6" java.lang.NullPointerException at rsb.patterns.LocalMethod.internalNotify(LocalMethod.java:121) at rsb.eventprocessing.SingleThreadEventReceivingStrategy$DispatchThread.run(SingleThreadEventReceivingStrategy.java:100) java.util.concurrent.TimeoutException at rsb.patterns.Future.get(Future.java:173) at rsb.patterns.RemoteServer.call(RemoteServer.java:226) at rsb.patterns.RemoteServer.call(RemoteServer.java:192) at rsb.patterns.RemoteServer.call(RemoteServer.java:251) at org.openbase.jul.extension.rsb.com.RSBTest.main(RSBTest.java:48)
Associated revisions
Backport: Prevent errors in case a callback returns null
Proactively handle returned null values from a method callback.
fixes #2773
(cherry picked from commit 87cbde949bf9296941fa10e502a0b718cb95e5bb)
History
#1 Updated by J. Wienke almost 6 years ago
The callback should always return an instance of Event
. null
is not allowed here and also not mentioned as a possibility in the documentation. I will add handling for this to the master version, but I don't think it is necessary to port this back to 0.18 as this is a usage error.
#2 Updated by J. Wienke almost 6 years ago
- Assignee set to J. Wienke
#3 Updated by J. Wienke almost 6 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Applied in changeset rsb-java|50bbc72bd6aad9d32c34991c4a95ee89166a5228.