mauricio / postgresql-async

Async, Netty based, database drivers for PostgreSQL and MySQL written in Scala
Apache License 2.0
1.43k stars 222 forks source link

getting NPE when connection not connected #215

Open oshai opened 7 years ago

oshai commented 7 years ago

This happened because I didn't call connection.connect(). If it is possible, I suggest to improve the message in such case. Here is the stacktrace:

Exception in thread "main" java.lang.NullPointerException at com.github.mauricio.async.db.mysql.codec.MySQLConnectionHandler.com$github$mauricio$async$db$mysql$codec$MySQLConnectionHandler$$writeAndHandleError(MySQLConnectionHandler.scala:324) at com.github.mauricio.async.db.mysql.codec.MySQLConnectionHandler.sendPreparedStatement(MySQLConnectionHandler.scala:208) at com.github.mauricio.async.db.mysql.MySQLConnection.sendPreparedStatement(MySQLConnection.scala:241)

oshai commented 5 years ago

I merged a fix to the fork of jasync-sql: https://github.com/jasync-sql/jasync-sql/pull/14