I can also now confirm that this was introduced in 1.4.200, when I downgrade to 1.4.199, this test works as expected.
Cheers, Paul On Monday, November 2, 2020 at 12:44:50 AM UTC+1 pwagland wrote: > Hi all, > > We are trying to upgrade from H2 1.3.153 to 1.4.200, and are running into > the following NPE: > > org.h2.jdbc.JdbcSQLNonTransientException: General error: > "java.lang.NullPointerException"; SQL statement: > select time_value, formatdatetime(time_value, 'HH:mm:ss.SSS') from > JDBCHelperTest where test_name = ? [50000-200] > at org.h2.message.DbException.getJdbcSQLException(DbException.java:505) > at org.h2.message.DbException.getJdbcSQLException(DbException.java:429) > at org.h2.message.DbException.get(DbException.java:194) > at org.h2.message.DbException.convert(DbException.java:347) > at org.h2.command.Command.executeQuery(Command.java:212) > at > org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:114) > at com.xxx.JDBCHelperTest.checkTime(JDBCHelperTest.java:428) > at com.xxx.JDBCHelperTest.testBindByPosition_Time(JDBCHelperTest.java:1272) > <snip the boring bits of junit> > Caused by: java.lang.NullPointerException > at org.h2.value.Value.convertToTimestamp(Value.java:1146) > at org.h2.value.Value.convertTo(Value.java:822) > at org.h2.value.Value.convertTo(Value.java:737) > at org.h2.value.Value.getTimestamp(Value.java:591) > at org.h2.expression.function.Function.getValueWithArgs(Function.java:1530) > at org.h2.expression.function.Function.getValue(Function.java:672) > at > org.h2.command.dml.Select$LazyResultQueryFlat.fetchNextRow(Select.java:1851) > at org.h2.result.LazyResult.hasNext(LazyResult.java:101) > at org.h2.result.LazyResult.next(LazyResult.java:60) > at org.h2.command.dml.Select.queryFlat(Select.java:737) > at org.h2.command.dml.Select.queryWithoutCache(Select.java:844) > at org.h2.command.dml.Query.queryWithoutCacheLazyCheck(Query.java:201) > at org.h2.command.dml.Query.query(Query.java:489) > at org.h2.command.dml.Query.query(Query.java:451) > at org.h2.command.CommandContainer.query(CommandContainer.java:285) > at org.h2.command.Command.executeQuery(Command.java:195) > ... 25 more > > As far as I can tell, this would still fail on current master as well, > it's a little more difficult to test there though, as there are no > pre-built binaries that I could find… > > However, what happens is that `Value.getTimesstamp(TimeZone)` calls > `Value. convertTo(Value.*TIMESTAMP*))`, which in turn calls > `Value.convertTo(targetType, *null*, *null*, *false*, *null*)`. That > third *null*, is `CastDataProvider provider`. This provider is `null`, > however when it is passed to `Value.convertToTimestamp(provider, > forComparison)`, that method assumes that *provider*, isn't null, and > thus we get the NPE. > > The SQL that we are passing in can be seen in the stack trace. I can't see > anything wrong with the query, nor can I see any obvious workaround. I am > hoping that someone here will be able to help me see what we have done > wrong, and how we can fix it without needing to wait for 2.0.202. > > Cheers, > Paul > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/h2-database/64484957-7fd9-47ba-bdb9-0934f1c6b9abn%40googlegroups.com.
