eclipse-vertx / vertx-sql-client

High performance reactive SQL Client written in Java
Apache License 2.0
887 stars 199 forks source link

ExtendedQueryResultHandler must check the async result is succeeded before unboxing its boolean value #73

Closed jklingsporn closed 6 years ago

jklingsporn commented 6 years ago

I'm firing the same insert query two times and expect to get a database exception, but I get a NPE instead. It seems to be a autoboxing issue: when there is an exception, ExtendedQueryResultHandler.handle is called and res returns null which cannot be casted to primitive boolean.

Version: 0.5.2 Stacktrace: 17:58:42.481 [vert.x-eventloop-thread-0] ERROR io.vertx.core.impl.ContextImpl - Unhandled exception java.lang.NullPointerException: null at com.julienviet.pgclient.impl.ExtendedQueryResultHandler.handle(ExtendedQueryResultHandler.java:45) ~[reactive-pg-client-0.5.2.jar:na] at com.julienviet.pgclient.impl.ExtendedQueryResultHandler.handle(ExtendedQueryResultHandler.java:24) ~[reactive-pg-client-0.5.2.jar:na] at com.julienviet.pgclient.impl.CommandBase.handleMessage(CommandBase.java:44) ~[reactive-pg-client-0.5.2.jar:na] at com.julienviet.pgclient.impl.QueryCommandBase.handleMessage(QueryCommandBase.java:51) ~[reactive-pg-client-0.5.2.jar:na] at com.julienviet.pgclient.impl.ExtendedQueryCommandBase.handleMessage(ExtendedQueryCommandBase.java:68) ~[reactive-pg-client-0.5.2.jar:na] at com.julienviet.pgclient.impl.ExtendedQueryCommand.handleMessage(ExtendedQueryCommand.java:31) ~[reactive-pg-client-0.5.2.jar:na] at com.julienviet.pgclient.impl.SocketConnection.handleMessage(SocketConnection.java:233) ~[reactive-pg-client-0.5.2.jar:na]

jklingsporn commented 6 years ago

Fix ready.

willks commented 6 years ago

I have tested this version and all the other logged exceptions in my extensive project test cases work perfectly with not one error. I ran the repeat cycle (60+ tests) on loop for the last hour or so. Looking very good and thanks for all the hard work.

vietj commented 6 years ago

I've done a 0.6.0 release containing the fix, as well as Numeric support