Hi,

I believe this is now fixed in the trunk, see
https://github.com/h2database/h2database/commit/b8a04500a5aec9a951011cddd43b660fb1ca7746

Regards,
Thomas


On Wed, Sep 30, 2015 at 1:34 PM, Václav Haisman <[email protected]> wrote:

> Hi.
>
> We are experiencing occasional errors with this stack trace:
>
> Caused by: org.h2.jdbc.JdbcSQLException: General error: 
> "java.lang.NullPointerException" [50000-189]
>     at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
>     at org.h2.message.DbException.get(DbException.java:168)
>     at org.h2.message.DbException.convert(DbException.java:295)
>     at org.h2.engine.Database.openDatabase(Database.java:300)
>     at org.h2.engine.Database.<init>(Database.java:263)
>     at org.h2.engine.Engine.openSession(Engine.java:65)
>     at org.h2.engine.Engine.openSession(Engine.java:175)
>     at org.h2.engine.Engine.createSessionAndValidate(Engine.java:153)
>     at org.h2.engine.Engine.createSession(Engine.java:136)
>     at org.h2.engine.Engine.createSession(Engine.java:28)
>     at 
> org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:349)
>     at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:107)
>     at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:91)
>     at org.h2.Driver.connect(Driver.java:72)
>     at 
> org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
>     at 
> org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
>     at 
> org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
>     at 
> org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
>     ... 68 more
> Caused by: java.lang.NullPointerException
>
>     at java.nio.ByteBuffer.wrap(Unknown Source)
>     at org.h2.mvstore.StreamStore.getMaxBlockKey(StreamStore.java:249)
>     at org.h2.mvstore.StreamStore.getMaxBlockKey(StreamStore.java:269)
>     at org.h2.store.LobStorageMap.init(LobStorageMap.java:114)
>     at org.h2.engine.Database.open(Database.java:767)
>     at org.h2.engine.Database.openDatabase(Database.java:269)
>     ... 82 more
>
> I have attached a debugger and looked around in getMaxBlockKey():
>
>     public long getMaxBlockKey(byte[] id) {
>         long maxKey = -1;
>         ByteBuffer idBuffer = ByteBuffer.wrap(id);
>         while (idBuffer.hasRemaining()) {
>             switch (idBuffer.get()) {
>             case 0:
>                 // in-place: 0, len (int), data
>                 int len = DataUtils.readVarInt(idBuffer);
>                 idBuffer.position(idBuffer.position() + len);
>                 break;
>             case 1:
>                 // block: 1, len (int), blockId (long)
>                 DataUtils.readVarInt(idBuffer);
>                 long k = DataUtils.readVarLong(idBuffer);
>                 maxKey = Math.max(maxKey, k);
>                 break;
>             case 2:
>                 // indirect: 2, total len (long), blockId (long)
>                 DataUtils.readVarLong(idBuffer);
>                 long k2 = DataUtils.readVarLong(idBuffer);
>                 // recurse
>                 byte[] r = map.get(k2);
>                 maxKey = Math.max(maxKey, getMaxBlockKey(r));
>                 break;
>             default:
>                 throw DataUtils.newIllegalArgumentException(
>                         "Unsupported id {0}", Arrays.toString(id));
>             }
>         }
>         return maxKey;
>     }
>
> It appears that the id argument is null in the recursive call from the
> case 2 branch.
>
> Is this a known issue? Should I report elsewhere than this group?
> ​
> --
> VH
>
> --
> 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 post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to