Backendless Support
 
Waiting for user's response

NullPointerException while debugging custom business logic (Java CodeRunner)

I debug my custom business logic code with CodeRunner and whenever I try to go out of scope of handleEvent method ( i.e. when I try to step out after the return statement ), the following exception is thrown:

java.lang.NullPointerException Cannot evaluate com.backendless.coderunner.commons.protocol.InvocationResult.toString()

This is how my event handler looks like:

  1. public class myEventEventHandler extends com.backendless.servercode.extension.CustomEventHandler
  2. {
  3. //...
  4. public Map<String, Object> handleEvent( RunnerContext context, Map eventArgs )
  5. {
  6. Map<String, Object> result = new HashMap<String, Object>();
  7. //...
  8. return result;
  9. }
  10. }

If I don't set any breakpoints, no exceptions are thrown.

I use CodeRunner™ v3.0.16 for Java and IntelliJ IDEA 16.1.2

Leave a Comment

Comments (4)

photo
1

Hi!

Please download latest code runner sdk from code generation (on business logic page)

and try this use case again.

photo
1

Hi Kate,

I've updated code runner, but I'm still getting this exception

photo
photo
1

The behavior you describe may occur because the InvocationResult object is null, and IntelliJ IDEA tries to execute it's toString() method in order to show you it's state. That's why you don't receive any errors when not debugging.

photo
2

Unfortunately, I am not sure what InvocationResult exactly is, as I cannot access the CodeRunner source code, and I can only guess why it is null and whether it all works as expected. Hopefully, it is not a symptom of a bigger problem and it would not affect the server code itself

photo