Added a check on moving bin & config plugin dirs

Plugins can contain bin & config sub-dirs that are copied to es's bin & config directories. If moving these directories fails we now throw an error.
This commit is contained in:
uboness 2014-07-09 22:56:45 +02:00
parent 808c52706a
commit 6dae32b09a
1 changed files with 6 additions and 2 deletions

View File

@ -211,7 +211,9 @@ public class PluginManager {
File toLocation = pluginHandle.binDir(environment); File toLocation = pluginHandle.binDir(environment);
debug("Found bin, moving to " + toLocation.getAbsolutePath()); debug("Found bin, moving to " + toLocation.getAbsolutePath());
FileSystemUtils.deleteRecursively(toLocation); FileSystemUtils.deleteRecursively(toLocation);
binFile.renameTo(toLocation); if (!binFile.renameTo(toLocation)) {
throw new IOException("Could not move ["+ binFile.getAbsolutePath() + "] to [" + toLocation.getAbsolutePath() + "]");
}
debug("Installed " + name + " into " + toLocation.getAbsolutePath()); debug("Installed " + name + " into " + toLocation.getAbsolutePath());
} }
@ -220,7 +222,9 @@ public class PluginManager {
File toLocation = pluginHandle.configDir(environment); File toLocation = pluginHandle.configDir(environment);
debug("Found config, moving to " + toLocation.getAbsolutePath()); debug("Found config, moving to " + toLocation.getAbsolutePath());
FileSystemUtils.deleteRecursively(toLocation); FileSystemUtils.deleteRecursively(toLocation);
configFile.renameTo(toLocation); if (!configFile.renameTo(toLocation)) {
throw new IOException("Could not move ["+ configFile.getAbsolutePath() + "] to [" + configFile.getAbsolutePath() + "]");
}
debug("Installed " + name + " into " + toLocation.getAbsolutePath()); debug("Installed " + name + " into " + toLocation.getAbsolutePath());
} }