dongoewang opened a new issue, #30329: URL: https://github.com/apache/shardingsphere/issues/30329
## Bug Report Caused by: java.lang.IllegalArgumentException: argument type mismatch **For English only**, other languages will not accept. Before report a bug, make sure you have: - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues). - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview). Please pay attention on issues you submitted, because we maybe need more details. If no response anymore and we cannot reproduce it on current information, we will **close it**. Please answer these questions before submitting your issue. Thanks! ### Which version of ShardingSphere did you use? 5.4.0 ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy? ShardingSphere-JDBC ### Expected behavior following of method always is returned ,but occasionally following of method is returned : public void setDbType(String dbType) { this.dbTypeName = dbType; } ### Actual behavior sometime following of method is returned : public void setDbType(DbType dbType) { if (dbType == null) { this.dbTypeName = null; } else { this.dbTypeName = dbType.name(); } } ### Reason analyze (If you can) when datasource is DruidDataSource,paramter type is not considered。 original method: private Optional<Method> findSetterMethod(final String fieldName,) { return Arrays.stream(dataSourceMethods).filter(each -> each.getName().equals(setterMethodName) && 1 == each.getParameterTypes().length).findFirst(); } modified method: private Optional<Method> findSetterMethod(final String fieldName, final Object fieldValue) { String setterMethodName = SETTER_PREFIX + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, fieldName); // TODO 这里下面改了 return Arrays.stream(dataSourceMethods).filter(each -> each.getName().equals(setterMethodName) && 1 == each.getParameterTypes().length && each.getParameterTypes()[0]==fieldValue.getClass()).findFirst(); // TODO 这里上面改了 // TODO 这里下面原来的代码 // return Arrays.stream(dataSourceMethods).filter(each -> each.getName().equals(setterMethodName) && 1 == each.getParameterTypes().length).findFirst(); // TODO 这里上面原来的代码 } ### 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
