Add missing try with resources in InstallPluginCommandTest, this should fix the build on windows.

This commit is contained in:
Jim Ferenczi 2016-02-11 15:13:25 +01:00
parent 46cab6d2ec
commit cb50e73f7c
1 changed files with 4 additions and 1 deletions

View File

@ -20,6 +20,7 @@
package org.elasticsearch.plugins; package org.elasticsearch.plugins;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@ -203,7 +204,9 @@ public class InstallPluginCommandTests extends ESTestCase {
Path pluginDir = createTempDir(); Path pluginDir = createTempDir();
String pluginZip = createPlugin("fake", pluginDir); String pluginZip = createPlugin("fake", pluginDir);
Path pluginZipWithSpaces = createTempFile("foo bar", ".zip"); Path pluginZipWithSpaces = createTempFile("foo bar", ".zip");
Files.copy(new URL(pluginZip).openStream(), pluginZipWithSpaces, StandardCopyOption.REPLACE_EXISTING); try (InputStream in = new URL(pluginZip).openStream()) {
Files.copy(in, pluginZipWithSpaces, StandardCopyOption.REPLACE_EXISTING);
}
installPlugin(pluginZipWithSpaces.toUri().toURL().toString(), env); installPlugin(pluginZipWithSpaces.toUri().toURL().toString(), env);
assertPlugin("fake", pluginDir, env); assertPlugin("fake", pluginDir, env);
} }