diff --git a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutor.java b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutor.java index 44514d9e9ad39..8bdb5712514eb 100644 --- a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutor.java +++ b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutor.java @@ -34,7 +34,6 @@ import java.util.LinkedList; import java.util.Map; import java.util.Optional; -import java.util.Properties; import java.util.stream.Collectors; /** @@ -67,14 +66,14 @@ private Collection buildColumnData(final EncryptTableRu tableRuleConfig.getName(), each.getName(), each.getCipher().getName(), - each.getAssistedQuery().map(EncryptColumnItemRuleConfiguration::getName).orElse(""), - each.getLikeQuery().map(EncryptColumnItemRuleConfiguration::getName).orElse(""), + each.getAssistedQuery().map(EncryptColumnItemRuleConfiguration::getName), + each.getLikeQuery().map(EncryptColumnItemRuleConfiguration::getName), encryptorAlgorithmConfig.getType(), encryptorAlgorithmConfig.getProps(), - assistedQueryEncryptorAlgorithmConfig.map(AlgorithmConfiguration::getType).orElse(""), - assistedQueryEncryptorAlgorithmConfig.map(AlgorithmConfiguration::getProps).orElse(new Properties()), - likeQueryEncryptorAlgorithmConfig.map(AlgorithmConfiguration::getType).orElse(""), - likeQueryEncryptorAlgorithmConfig.map(AlgorithmConfiguration::getProps).orElse(new Properties()))); + assistedQueryEncryptorAlgorithmConfig.map(AlgorithmConfiguration::getType), + assistedQueryEncryptorAlgorithmConfig.map(AlgorithmConfiguration::getProps), + likeQueryEncryptorAlgorithmConfig.map(AlgorithmConfiguration::getType), + likeQueryEncryptorAlgorithmConfig.map(AlgorithmConfiguration::getProps))); } return result; } diff --git a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/ArgsUtils.java b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/ArgsUtils.java index 59e89dd6dcb73..124042939d0f5 100644 --- a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/ArgsUtils.java +++ b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/ArgsUtils.java @@ -80,17 +80,17 @@ public static String replaceArg(final String targetValue, final String defaultVa } /** - * Get configuration file. + * Get configuration subject. * * @param url URL * @param urlPrefix URL prefix - * @param pathType path type - * @return configuration file + * @param configurationType configuration type + * @return configuration subject */ - public static String getConfigurationFile(final String url, final String urlPrefix, final String pathType) { + public static String getConfigurationSubject(final String url, final String urlPrefix, final String configurationType) { String configuredFile = url.substring(urlPrefix.length(), url.contains("?") ? url.indexOf('?') : url.length()); - String result = configuredFile.substring(pathType.length()); - Preconditions.checkArgument(!result.isEmpty(), "Configuration file is required in ShardingSphere URL."); + String result = configuredFile.substring(configurationType.length()); + Preconditions.checkArgument(!result.isEmpty(), "Configuration subject is required in driver URL."); return result; } diff --git a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/absolutepath/AbsolutePathURLProvider.java b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/absolutepath/AbsolutePathURLProvider.java index 65d77487d5373..602a780158b72 100644 --- a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/absolutepath/AbsolutePathURLProvider.java +++ b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/absolutepath/AbsolutePathURLProvider.java @@ -41,7 +41,7 @@ public String getPathType() { @Override @SneakyThrows(IOException.class) public byte[] getContent(final String url, final String urlPrefix) { - String file = ArgsUtils.getConfigurationFile(url, urlPrefix, getPathType()); + String file = ArgsUtils.getConfigurationSubject(url, urlPrefix, getPathType()); try ( InputStream stream = Files.newInputStream(new File(file).toPath()); BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) { diff --git a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/absolutepath/AbsolutePathWithEnvironmentURLProvider.java b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/absolutepath/AbsolutePathWithEnvironmentURLProvider.java index ec43e84da817a..e8280d97758fd 100644 --- a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/absolutepath/AbsolutePathWithEnvironmentURLProvider.java +++ b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/absolutepath/AbsolutePathWithEnvironmentURLProvider.java @@ -42,7 +42,7 @@ public String getPathType() { @Override @SneakyThrows(IOException.class) public byte[] getContent(final String url, final String urlPrefix) { - String file = ArgsUtils.getConfigurationFile(url, urlPrefix, getPathType()); + String file = ArgsUtils.getConfigurationSubject(url, urlPrefix, getPathType()); try ( InputStream stream = Files.newInputStream(new File(file).toPath()); BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) { diff --git a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/classpath/ClasspathURLProvider.java b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/classpath/ClasspathURLProvider.java index c68edb77992a9..acb7d37ad1cd1 100644 --- a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/classpath/ClasspathURLProvider.java +++ b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/classpath/ClasspathURLProvider.java @@ -39,7 +39,7 @@ public String getPathType() { @Override @SneakyThrows(IOException.class) public byte[] getContent(final String url, final String urlPrefix) { - String file = ArgsUtils.getConfigurationFile(url, urlPrefix, getPathType()); + String file = ArgsUtils.getConfigurationSubject(url, urlPrefix, getPathType()); try ( InputStream stream = ArgsUtils.getResourceAsStreamFromClasspath(file); BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) { diff --git a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/classpath/ClasspathWithEnvironmentURLProvider.java b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/classpath/ClasspathWithEnvironmentURLProvider.java index 82ca3b2acd09b..4d635a7230dbb 100644 --- a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/classpath/ClasspathWithEnvironmentURLProvider.java +++ b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/classpath/ClasspathWithEnvironmentURLProvider.java @@ -40,7 +40,7 @@ public String getPathType() { @Override @SneakyThrows(IOException.class) public byte[] getContent(final String url, final String urlPrefix) { - String file = ArgsUtils.getConfigurationFile(url, urlPrefix, getPathType()); + String file = ArgsUtils.getConfigurationSubject(url, urlPrefix, getPathType()); try ( InputStream stream = ArgsUtils.getResourceAsStreamFromClasspath(file); BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) { diff --git a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/classpath/ClasspathWithSystemPropsURLProvider.java b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/classpath/ClasspathWithSystemPropsURLProvider.java index 8ff7f2213428a..ad47fb136f6f3 100644 --- a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/classpath/ClasspathWithSystemPropsURLProvider.java +++ b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/classpath/ClasspathWithSystemPropsURLProvider.java @@ -40,7 +40,7 @@ public String getPathType() { @Override @SneakyThrows(IOException.class) public byte[] getContent(final String url, final String urlPrefix) { - String file = ArgsUtils.getConfigurationFile(url, urlPrefix, getPathType()); + String file = ArgsUtils.getConfigurationSubject(url, urlPrefix, getPathType()); try ( InputStream stream = ArgsUtils.getResourceAsStreamFromClasspath(file); BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) {