henrypoter opened a new issue #5390:
URL: https://github.com/apache/shardingsphere/issues/5390
## Bug Report
### Which version of ShardingSphere did you use?
4.1.0
### Which project did you use? Sharding-JDBC or Sharding-Proxy?
sharding-scaling
### Expected behavior
### Actual behavior
I use sharding-scaling and sharding-proxy to move data from old cluster to
the new cluster.
Below exception occured:
`[ERROR] 09:53:53.645 [pool-1-thread-21]
o.a.s.s.c.e.e.SyncTaskExecuteCallback - RealtimeDataSyncTask
realtime-hc_hiwork_suite_new execute exception exit
java.lang.NullPointerException: null
at
org.apache.shardingsphere.shardingscaling.mysql.MySQLBinlogReader.handleUpdateRowsEvent(MySQLBinlogReader.java:137)
at
org.apache.shardingsphere.shardingscaling.mysql.MySQLBinlogReader.read(MySQLBinlogReader.java:97)
at
org.apache.shardingsphere.shardingscaling.mysql.MySQLBinlogReader.run(MySQLBinlogReader.java:75)
`
the following code caused a nullpointexception:
`!oldValue.equals(newValue)`
The reason is that there is a field, it's oldValue is null.
### Reason analyze (If you can)
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule
configuration, when exception occur etc.
Use scaling to sync database, and update a row which has null value.
### Example codes for reproduce this issue (such as a github link).
The correct logic :
`boolean updated = false;
if(null == oldValue){
updated = null != newValue;
}else{
updated = !oldValue.equals(newValue);
}`
----------------------------------------------------------------
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:
[email protected]