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

LongConverter is throwing NullPointerException on returning null #1211

Closed
aquddos123 opened this issue Apr 18, 2019 · 5 comments

Comments

Projects
None yet
2 participants
@aquddos123
Copy link

commented Apr 18, 2019

We are using SliM decision table and recently upgraded FitNesse from release 20161106 to 20190416.

We use to have getters with return type "int" and "long" working fine when null is returned.
But after this version upgrade we started seeing NullPointerException for null objects returned as long. See below Exception details.

I can see discussion in #363 and #686 to convert null objects into "null" but they are very old discussions. Are there any new changes made to SliM Converter after 20161106 release?

EXCEPTION:java.lang.NullPointerException
at fitnesse.slim.converters.LongConverter.toString(LongConverter.java:7) [fitnesse-20190416.jar:20190416]
at fitnesse.slim.converters.LongConverter.toString(LongConverter.java:5) [fitnesse-20190416.jar:20190416]
at fitnesse.slim.MethodExecutionResult.toString(MethodExecutionResult.java:94) [fitnesse-20190416.jar:20190416]
at fitnesse.slim.MethodExecutionResult.returnValue(MethodExecutionResult.java:85) [fitnesse-20190416.jar:20190416]
at fitnesse.slim.StatementExecutor.call(StatementExecutor.java:112) [fitnesse-20190416.jar:20190416]
at fitnesse.slim.instructions.CallInstruction.executeInternal(CallInstruction.java:35) [fitnesse-20190416.jar:20190416]
at fitnesse.slim.instructions.Instruction.execute(Instruction.java:29) [fitnesse-20190416.jar:20190416]
at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:49) [fitnesse-20190416.jar:20190416]
at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:43) [fitnesse-20190416.jar:20190416]
at fitnesse.slim.ListExecutor.execute(ListExecutor.java:85) [fitnesse-20190416.jar:20190416]
at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:82) [fitnesse-20190416.jar:20190416]
at fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:75) [fitnesse-20190416.jar:20190416]
at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:62) [fitnesse-20190416.jar:20190416]
at fitnesse.slim.SlimServer.serve(SlimServer.java:47) [fitnesse-20190416.jar:20190416]
at fitnesse.slim.SlimService.handle(SlimService.java:169) [fitnesse-20190416.jar:20190416]
at fitnesse.slim.SlimService.acceptOne(SlimService.java:177) [fitnesse-20190416.jar:20190416]
at fitnesse.slim.SlimService.accept(SlimService.java:139) [fitnesse-20190416.jar:20190416]
at fitnesse.slim.SlimService.startWithFactory(SlimService.java:92) [fitnesse-20190416.jar:20190416]
at fitnesse.slim.SlimService.main(SlimService.java:57) [fitnesse-20190416.jar:20190416]

@fhoeben

This comment has been minimized.

Copy link
Collaborator

commented Apr 18, 2019

I believe that the behaviour for Long objects was indeed changed in #602

The conversion does indeed not seem null safe. Seems quite easy to fix, other converters are ok.

As a workaround you could (temporary) register your own converter for longs...

public class LongConverter implements Converter<Long> {
  public String toString(Long o) {
    return o != null ? o.toString() : NULL_VALUE;
  }

  public Long fromString(String arg) {
    return Long.parseLong(arg);
  }
}

@aquddos123 aquddos123 closed this Apr 18, 2019

@aquddos123 aquddos123 reopened this Apr 18, 2019

@aquddos123

This comment has been minimized.

Copy link
Author

commented Apr 18, 2019

Sorry I mistakenly closed.

@aquddos123

This comment has been minimized.

Copy link
Author

commented Apr 18, 2019

@fhoeben what do you mean by "temporarily" register a converter. Is this feature going to change again in near future?

@fhoeben

This comment has been minimized.

Copy link
Collaborator

commented Apr 18, 2019

i expect to release a fixed version soon....

@aquddos123

This comment has been minimized.

Copy link
Author

commented Apr 18, 2019

Thanks @fhoeben.

@fhoeben fhoeben closed this in 6de711e Apr 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.