Bug #2773

Internal invoke nullpointer not handeled.

Added by M. Pohling 11 months ago. Updated 11 months ago.

Status:ResolvedStart date:10/17/2018
Priority:NormalDue 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

Revision 50bbc72b
Added by J. Wienke 11 months ago

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 11 months 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 11 months ago

  • Assignee set to J. Wienke

#3 Updated by J. Wienke 11 months ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF