Duration option leads to NullPointerException
See original GitHub issueI have to following model property:
def totalTime = column[Option[Duration]]("total_time")
SQL: total_time INTERVAL
which works perfectly when the database value is not null. As soon as the value is null I get the following exception:
[warn] c.z.h.p.ProxyConnection - db - Connection org.postgresql.jdbc.PgConnection@592d34d1 marked as broken because of SQLSTATE(08006), ErrorCode(0)
org.postgresql.util.PSQLException: Failed to create object for: interval.
at org.postgresql.jdbc.PgConnection.getObject(PgConnection.java:586)
at org.postgresql.jdbc.PgResultSet.getObject(PgResultSet.java:3360)
at com.zaxxer.hikari.pool.HikariProxyResultSet.getObject(HikariProxyResultSet.java)
at com.github.tminglei.slickpg.date.PgDateJdbcTypes$GenericDateJdbcType.getValue(PgDateJdbcTypes.scala:43)
at slick.jdbc.SpecializedJdbcResultConverter$$anon$2.read(SpecializedJdbcResultConverters.scala:45)
at slick.jdbc.SpecializedJdbcResultConverter$$anon$2.read(SpecializedJdbcResultConverters.scala:43)
at slick.relational.ProductResultConverter.read(ResultConverter.scala:53)
at slick.relational.ProductResultConverter.read(ResultConverter.scala:43)
at slick.relational.TypeMappingResultConverter.read(ResultConverter.scala:133)
at slick.jdbc.JdbcInvokerComponent$QueryInvokerImpl.extractValue(JdbcInvokerComponent.scala:36)
Caused by: java.lang.NullPointerException: null
at org.postgresql.util.PGInterval.setValue(PGInterval.java:80)
at org.postgresql.jdbc.PgConnection.getObject(PgConnection.java:571)
at org.postgresql.jdbc.PgResultSet.getObject(PgResultSet.java:3360)
at com.zaxxer.hikari.pool.HikariProxyResultSet.getObject(HikariProxyResultSet.java)
at com.github.tminglei.slickpg.date.PgDateJdbcTypes$GenericDateJdbcType.getValue(PgDateJdbcTypes.scala:43)
at slick.jdbc.SpecializedJdbcResultConverter$$anon$2.read(SpecializedJdbcResultConverters.scala:45)
at slick.jdbc.SpecializedJdbcResultConverter$$anon$2.read(SpecializedJdbcResultConverters.scala:43)
at slick.relational.ProductResultConverter.read(ResultConverter.scala:53)
at slick.relational.ProductResultConverter.read(ResultConverter.scala:43)
at slick.relational.TypeMappingResultConverter.read(ResultConverter.scala:133)
Looks like a problem with the Option. I am using version 15.2
of slick-pg with Play 2.6 and play-slick 3.0.0-M3
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
How to Fix and Avoid NullPointerException in Java - Rollbar
NullPointerException in Java occurs when a variable is accessed which is not pointing to any object and refers to nothing or null.
Read more >Handling Java NullPointerException and Best Practices
NullPointerException is a runtime condition where we try to access or modify an object which has not been initialized yet. It essentially means ......
Read more >java - What is a NullPointerException, and how do I fix it?
Thrown when an application attempts to use null in a case where an object is required. These include: Calling the instance method of...
Read more >Java NullPointerException - Detect, Fix, and Best Practices
NullPointerException when getting the length of null array ... it's very clear from stack trace what is causing null pointer exception.
Read more >What Is NullPointerException In Java & How To Avoid It
Accessing or modifying a field or data member of the null object. Passing null object as an argument to a method. Calculating the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@perotom will release it ASAP.
This issue should be fixed in #360 by @andrezimmermann.