question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Duration option leads to NullPointerException

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tmingleicommented, Aug 1, 2017

@perotom will release it ASAP.

1reaction
tmingleicommented, Jul 31, 2017

This issue should be fixed in #360 by @andrezimmermann.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found