Fix Files name collision

Regression from b282b5cbfe.
This commit is contained in:
Andrew Gaul 2022-11-21 07:49:18 +09:00
parent b282b5cbfe
commit 552eb95c44
4 changed files with 5 additions and 9 deletions

View File

@ -31,7 +31,6 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.nio.file.Files;
import java.util.Random; import java.util.Random;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -269,7 +268,7 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base
Payload payload = null; Payload payload = null;
try { try {
f = Files.createTempFile("jclouds", "tmp").toFile(); f = java.nio.file.Files.createTempFile("jclouds", "tmp").toFile();
long length = (new Random().nextInt(32) + 1) * 1024L * 1024L; long length = (new Random().nextInt(32) + 1) * 1024L * 1024L;
TestUtils.randomByteSource().slice(0, length).copyTo(Files.asByteSink(f)); TestUtils.randomByteSource().slice(0, length).copyTo(Files.asByteSink(f));

View File

@ -43,7 +43,6 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import java.net.URI; import java.net.URI;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.file.Files;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -1037,7 +1036,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
public void testMultipartWithParamFilePart() throws Exception { public void testMultipartWithParamFilePart() throws Exception {
Invokable<?, ?> method = method(TestMultipartForm.class, "withParamFilePart", String.class, Invokable<?, ?> method = method(TestMultipartForm.class, "withParamFilePart", String.class,
File.class); File.class);
File file = Files.createTempFile("foo", "bar").toFile(); File file = java.nio.file.Files.createTempFile("foo", "bar").toFile();
try { try {
Files.append("foobledata", file, UTF_8); Files.append("foobledata", file, UTF_8);
@ -1083,7 +1082,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
public void testMultipartWithParamFileBinaryPart() throws Exception { public void testMultipartWithParamFileBinaryPart() throws Exception {
Invokable<?, ?> method = method(TestMultipartForm.class, "withParamFileBinaryPart", Invokable<?, ?> method = method(TestMultipartForm.class, "withParamFileBinaryPart",
String.class, File.class); String.class, File.class);
File file = Files.createTempFile("foo", "bar").toFile(); File file = java.nio.file.Files.createTempFile("foo", "bar").toFile();
try { try {
Files.write(new byte[] { 17, 26, 39, 40, 50 }, file); Files.write(new byte[] { 17, 26, 39, 40, 50 }, file);

View File

@ -28,7 +28,6 @@ import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.net.InetAddress; import java.net.InetAddress;
import java.nio.file.Files;
import java.util.List; import java.util.List;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@ -162,7 +161,7 @@ public class JschSshClientLiveTest {
@Test @Test
public void testPutAndGet() throws IOException { public void testPutAndGet() throws IOException {
temp = Files.createTempFile("foo", "bar").toFile(); temp = java.nio.file.Files.createTempFile("foo", "bar").toFile();
try { try {
SshClient client = setupClient(); SshClient client = setupClient();
client.put(temp.getAbsolutePath(), Payloads.newStringPayload("rabbit")); client.put(temp.getAbsolutePath(), Payloads.newStringPayload("rabbit"));

View File

@ -26,7 +26,6 @@ import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.net.InetAddress; import java.net.InetAddress;
import java.nio.file.Files;
import org.jclouds.compute.domain.ExecChannel; import org.jclouds.compute.domain.ExecChannel;
import org.jclouds.compute.domain.ExecResponse; import org.jclouds.compute.domain.ExecResponse;
@ -149,7 +148,7 @@ public class SshjSshClientLiveTest {
} }
public void testPutAndGet() throws IOException { public void testPutAndGet() throws IOException {
temp = Files.createTempFile("foo", "bar").toFile(); temp = java.nio.file.Files.createTempFile("foo", "bar").toFile();
try { try {
SshClient client = setupClient(); SshClient client = setupClient();
client.put(temp.getAbsolutePath(), Payloads.newStringPayload("rabbit")); client.put(temp.getAbsolutePath(), Payloads.newStringPayload("rabbit"));