lealone / Lealone

比 MySQL 和 MongoDB 快10倍的 OLTP 关系数据库和文档数据库
Other
2.44k stars 514 forks source link

java.lang.NullPointerException: Cannot store to object array because "value" is null #193

Closed mervynzhang closed 1 year ago

mervynzhang commented 1 year ago

插入blob数据的时候, 用 FILE_READ 报错了。

create table if not exists pet1(name varchar(20), age int, d blob) INSERT INTO pet1 (name,age,d) VALUES('b3JlLmlk',12 ,RAWTOHEX('01020304'))

INSERT INTO pet1 (name,age,d) VALUES('abc',12 ,FILE_READ('test.jpg', NULL))


Caused by: java.lang.NullPointerException: Cannot store to object array because "value" is null
    at org.lealone.storage.aose.lob.LobStreamStorage.setTable(LobStreamStorage.java:218)
    at org.lealone.db.value.ValueLob.link(ValueLob.java:326)
    at org.lealone.db.index.standard.StandardPrimaryIndex.linkLargeObject(StandardPrimaryIndex.java:127)
    at org.lealone.db.index.standard.StandardPrimaryIndex.onAddSucceeded(StandardPrimaryIndex.java:163)
    at org.lealone.db.table.StandardTable.lambda$createAsyncCallbackForAddRow$1(StandardTable.java:362)
    at org.lealone.db.async.AsyncCallback.setAsyncResult(AsyncCallback.java:157)
    at org.lealone.db.table.StandardTable.lambda$addRow$2(StandardTable.java:391)
    at org.lealone.db.async.AsyncCallback.onComplete(AsyncCallback.java:137)
    at org.lealone.db.table.StandardTable.addRow(StandardTable.java:388)
    at org.lealone.sql.dml.MerSert$YieldableMerSert.addRowInternal(MerSert.java:200)
    at org.lealone.sql.dml.Insert$YieldableInsert.executeLoopUpdate(Insert.java:92)
    at org.lealone.sql.executor.YieldableLoopUpdateBase.executeInternal(YieldableLoopUpdateBase.java:31)
    at org.lealone.sql.executor.YieldableBase.run(YieldableBase.java:104)
    ... 3 more
    at org.lealone.net.TransferConnection.parseError(TransferConnection.java:72)
    at org.lealone.net.TcpClientConnection.handleResponse(TcpClientConnection.java:104)
    at org.lealone.net.TransferConnection.handle(TransferConnection.java:130)
    at org.lealone.net.nio.NioEventLoop.read(NioEventLoop.java:230)
    at org.lealone.net.nio.NioEventLoopClient.run(NioEventLoopClient.java:71)
    at org.lealone.net.nio.NioEventLoopClient.lambda$createNioEventLoop$0(NioEventLoopClient.java:43)
    at java.base/java.lang.Thread.run(Unknown Source)
codefollower commented 1 year ago

FILE_READ 读取的 lob 数据被放到 database 级的 lob 存储中了, 执行 insert 时对 lob 进行 link 使用的是 table 级的 lob 存储,所以找不到就抛 NPE。

bug 修复了,感谢报告问题。