do not silently fail on plugin install with source files

This commit is contained in:
Bernhard K. Weisshuhn 2013-09-25 13:04:54 +02:00 committed by Simon Willnauer
parent 63fdbe9b9b
commit 93a2742c84
3 changed files with 8 additions and 1 deletions

View File

@ -186,7 +186,7 @@ public class PluginManager {
if (FileSystemUtils.hasExtensions(extractLocation, ".java")) {
debug("Plugin installation assumed to be site plugin, but contains source code, aborting installation...");
FileSystemUtils.deleteRecursively(extractLocation);
return;
throw new IllegalArgumentException("Plugin installation assumed to be site plugin, but contains source code, aborting installation.");
}
File binFile = new File(extractLocation, "bin");

View File

@ -104,6 +104,13 @@ public class PluginManagerTests extends AbstractIntegrationTest {
assertPluginAvailable(nodeName, pluginName);
}
@Test(expected = IllegalArgumentException.class)
public void testSitePluginWithSourceThrows() throws Exception {
String pluginName = "plugin-with-source";
URL url = PluginManagerTests.class.getResource("plugin_with_sourcefiles.zip");
downloadAndExtract(pluginName, "file://" + url.getFile());
}
private static PluginManager pluginManager(String pluginUrl) {
Tuple<Settings, Environment> initialSettings = InternalSettingsPreparer.prepareSettings(
ImmutableSettings.settingsBuilder().build(), false);