You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/05/27 03:35:44 UTC
[GitHub] [shardingsphere] azraelee opened a new issue #5809: CaseExpressionContext#simpleExpr may throw NullPointerException (version: 4.1.0)
azraelee opened a new issue #5809:
URL: https://github.com/apache/shardingsphere/issues/5809
### Which version of ShardingSphere did you use?
version: 4.1.0
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
### Expected behavior
Execute SQL normally.
ShardingSphere-JDBC Version 4.0.0 does not have this problem
### Actual behavior
throw NullPointerException
### Reason analyze (If you can)
The following SQL is causing the problem
```
update xxx_table
<trim prefix="set" suffixOverrides=",">
<trim prefix="column1= case" suffix="end," >
<foreach collection="list" item="item" index="index">
<if test="item.column1 != null">
when id = #{item.id} then #{item.column1}
</if>
</foreach>
else column1
</trim>
<trim prefix="column2 = case" suffix="end," >
<foreach collection="list" item="item" index="index">
<if test="item.column2 != null">
when id = #{item.id} then #{item.column2}
</if>
</foreach>
else column2
</trim>
</trim>
where
<foreach collection="list" item="item" open="( " separator=") or (" close=" )">
id = #{item.id}
</foreach>
```
This is just a personal analysis, it may be wrong.
When analyzing this condition
```<trim prefix="column1= case" suffix="end," >```
MySQLVisitor#visitCaseExpression (MySQLVisitor.java line 585)call AbstractParseTreeVisitor#visit(CaseExpressionContext#simpleExpr)
will throw NullPointerException
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
### Example codes for reproduce this issue (such as a github link).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jingshanglu edited a comment on issue #5809: CaseExpressionContext#simpleExpr may throw NullPointerException (version: 4.1.0)
Posted by GitBox <gi...@apache.org>.
jingshanglu edited a comment on issue #5809:
URL: https://github.com/apache/shardingsphere/issues/5809#issuecomment-634516975
@azraelee It is the same to #5565, #5707 has solved it. new version will fix it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] kimmking closed issue #5809: CaseExpressionContext#simpleExpr may throw NullPointerException (version: 4.1.0)
Posted by GitBox <gi...@apache.org>.
kimmking closed issue #5809:
URL: https://github.com/apache/shardingsphere/issues/5809
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jingshanglu commented on issue #5809: CaseExpressionContext#simpleExpr may throw NullPointerException (version: 4.1.0)
Posted by GitBox <gi...@apache.org>.
jingshanglu commented on issue #5809:
URL: https://github.com/apache/shardingsphere/issues/5809#issuecomment-634516975
@azraelee It is the same to #5565, #5707 has solved it. new version is fix it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org