This is an automated email from the ASF dual-hosted git repository.
zhaojinchao 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 0f58f02e269 Refactor : extact variable to reduce the file transfer
(#29918)
0f58f02e269 is described below
commit 0f58f02e269adfc7f99ede960cad52890f33f84a
Author: 孙念君 Nianjun Sun <[email protected]>
AuthorDate: Tue Jan 30 19:07:14 2024 +0800
Refactor : extact variable to reduce the file transfer (#29918)
---
.../shardingsphere/agent/core/plugin/jar/PluginJarLoader.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/jar/PluginJarLoader.java
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/jar/PluginJarLoader.java
index 197baf5e530..0e4763e7769 100644
---
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/jar/PluginJarLoader.java
+++
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/jar/PluginJarLoader.java
@@ -44,7 +44,7 @@ public final class PluginJarLoader {
/**
* Load plugin jars.
- *
+ *
* @param agentRootPath agent root path
* @return plugin jars
* @throws IOException IO exception
@@ -66,8 +66,9 @@ public final class PluginJarLoader {
@Override
public FileVisitResult visitFile(final Path path, final
BasicFileAttributes attributes) {
- if (path.toFile().isFile() &&
path.toFile().getName().endsWith(".jar")) {
- result.add(path.toFile());
+ File currentFile = path.toFile();
+ if (currentFile.isFile() &&
currentFile.getName().endsWith(".jar")) {
+ result.add(currentFile);
}
return FileVisitResult.CONTINUE;
}