Add finals to RemovePluginCommand

This commit marks the RemovePluginCommand class as final, and marks
some local variables as final too.
This commit is contained in:
Jason Tedor 2016-09-06 07:39:23 -04:00
parent e081b2b2e8
commit ab86660c65
1 changed files with 5 additions and 5 deletions

View File

@ -43,7 +43,7 @@ import static org.elasticsearch.cli.Terminal.Verbosity.VERBOSE;
/**
* A command for the plugin cli to remove a plugin from elasticsearch.
*/
class RemovePluginCommand extends SettingCommand {
final class RemovePluginCommand extends SettingCommand {
private final OptionSpec<String> arguments;
@ -64,16 +64,16 @@ class RemovePluginCommand extends SettingCommand {
terminal.println("-> Removing " + Strings.coalesceToEmpty(pluginName) + "...");
Path pluginDir = env.pluginsFile().resolve(pluginName);
final Path pluginDir = env.pluginsFile().resolve(pluginName);
if (Files.exists(pluginDir) == false) {
throw new UserException(
ExitCodes.USAGE,
"plugin " + pluginName + " not found; run 'elasticsearch-plugin list' to get list of installed plugins");
}
List<Path> pluginPaths = new ArrayList<>();
final List<Path> pluginPaths = new ArrayList<>();
Path pluginBinDir = env.binFile().resolve(pluginName);
final Path pluginBinDir = env.binFile().resolve(pluginName);
if (Files.exists(pluginBinDir)) {
if (Files.isDirectory(pluginBinDir) == false) {
throw new UserException(ExitCodes.IO_ERROR, "Bin dir for " + pluginName + " is not a directory");
@ -83,7 +83,7 @@ class RemovePluginCommand extends SettingCommand {
}
terminal.println(VERBOSE, "Removing: " + pluginDir);
Path tmpPluginDir = env.pluginsFile().resolve(".removing-" + pluginName);
final Path tmpPluginDir = env.pluginsFile().resolve(".removing-" + pluginName);
Files.move(pluginDir, tmpPluginDir, StandardCopyOption.ATOMIC_MOVE);
pluginPaths.add(tmpPluginDir);