You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2022/06/02 02:12:47 UTC
[shardingsphere] branch master updated: replace orElse with orElseGet (#18145)
This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new aa8bf6cf102 replace orElse with orElseGet (#18145)
aa8bf6cf102 is described below
commit aa8bf6cf102f4d36fd40372258be741eb58de451
Author: Chuxin Chen <ch...@qq.com>
AuthorDate: Thu Jun 2 10:12:42 2022 +0800
replace orElse with orElseGet (#18145)
---
.../java/org/apache/shardingsphere/infra/rewrite/SQLRewriteEntry.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/shardingsphere-infra/shardingsphere-infra-rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/SQLRewriteEntry.java b/shardingsphere-infra/shardingsphere-infra-rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/SQLRewriteEntry.java
index 4999abd38da..6498038dc62 100644
--- a/shardingsphere-infra/shardingsphere-infra-rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/SQLRewriteEntry.java
+++ b/shardingsphere-infra/shardingsphere-infra-rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/SQLRewriteEntry.java
@@ -65,7 +65,7 @@ public final class SQLRewriteEntry {
*/
public SQLRewriteResult rewrite(final String sql, final List<Object> parameters, final SQLStatementContext<?> sqlStatementContext, final RouteContext routeContext) {
SQLRewriteContext sqlRewriteContext = createSQLRewriteContext(sql, parameters, sqlStatementContext, routeContext);
- SQLTranslatorRule rule = database.getRuleMetaData().findSingleRule(SQLTranslatorRule.class).orElse(new SQLTranslatorRule(new SQLTranslatorRuleConfiguration()));
+ SQLTranslatorRule rule = database.getRuleMetaData().findSingleRule(SQLTranslatorRule.class).orElseGet(() -> new SQLTranslatorRule(new SQLTranslatorRuleConfiguration()));
DatabaseType protocolType = database.getProtocolType();
DatabaseType storageType = database.getResource().getDatabaseType();
return routeContext.getRouteUnits().isEmpty()