Skip to content

Commit

Permalink
Fix some minor issues discovered by PMD (Programming Mistake Detector…
Browse files Browse the repository at this point in the history
…) plugins
  • Loading branch information
yizhenqiang committed Jan 24, 2025
1 parent 9cf6510 commit 74ea36f
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ protected void doInitialize(ZookeeperContext context) throws DubboTestException
// get the file name, just like apache-zookeeper-{version}-bin
// the version we maybe unknown if the zookeeper archive binary file is copied by user self.
Path parentPath = Paths.get(context.getSourceFile().getParent().toString(), String.valueOf(clientPort));
if (!Files.exists(parentPath) || !parentPath.toFile().isDirectory()) {
if (!Files.exists(parentPath)
|| !parentPath.toFile().isDirectory()) {
throw new IllegalStateException("There is something wrong in unpacked file!");
}

Expand All @@ -100,7 +101,9 @@ protected void doInitialize(ZookeeperContext context) throws DubboTestException
File targetFile = Paths.get(parentPath.toString(), context.getUnpackedDirectory()).toFile();
sourceFile.renameTo(targetFile);
if (!Files.exists(targetFile.toPath()) || !targetFile.isDirectory()) {
throw new IllegalStateException(String.format("Failed to rename the directory. source directory: %s, target directory: %s", sourceFile.toPath(), targetFile.toPath()));
throw new IllegalStateException(String.format(
"Failed to rename the directory. source directory: %s, target directory: %s",
sourceFile.toPath(), targetFile.toPath()));
}
// get the bin path
Path zookeeperBin = Paths.get(targetFile.toString(), "bin");
Expand Down

0 comments on commit 74ea36f

Please sign in to comment.