summaryrefslogtreecommitdiffstats
path: root/configserver/src
diff options
context:
space:
mode:
authorgjoranv <gv@verizonmedia.com>2020-01-07 11:38:22 +0100
committerGitHub <noreply@github.com>2020-01-07 11:38:22 +0100
commitfbea1c3b5a6020d6d5fbd5b76d1eb3e693152500 (patch)
tree24efa382235105fa1255e19cc29a75751de38c18 /configserver/src
parent03ad85915b39cadb1bc0e74b4fa6daec294a88de (diff)
parentef00c557ff5e5b33f6f9fdef83f5357201562ec1 (diff)
Merge pull request #11662 from vespa-engine/bjorncs/apache-commons-libraries-cleanup
Bjorncs/apache commons libraries cleanup
Diffstat (limited to 'configserver/src')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ZooKeeperClient.java3
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/http/SessionContentReadResponse.java5
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/http/StaticResponse.java3
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionContentHandlerTest.java8
4 files changed, 8 insertions, 11 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ZooKeeperClient.java b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ZooKeeperClient.java
index 401b6974596..13ef19f5f5d 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ZooKeeperClient.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ZooKeeperClient.java
@@ -17,7 +17,6 @@ import com.yahoo.path.Path;
import com.yahoo.vespa.config.ConfigDefinitionKey;
import com.yahoo.vespa.config.server.zookeeper.ConfigCurator;
import com.yahoo.vespa.config.server.zookeeper.ZKApplicationPackage;
-import org.apache.commons.io.IOUtils;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -249,7 +248,7 @@ public class ZooKeeperClient {
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (InputStream inputStream = file.createInputStream()) {
- IOUtils.copy(inputStream, baos);
+ inputStream.transferTo(baos);
baos.flush();
configCurator.putData(zkPath.append(file.getPath().getName()).getAbsolute(), baos.toByteArray());
}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/SessionContentReadResponse.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/SessionContentReadResponse.java
index 595575531d8..07d27ffd5de 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/SessionContentReadResponse.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/SessionContentReadResponse.java
@@ -3,13 +3,12 @@ package com.yahoo.vespa.config.server.http;
import com.yahoo.config.application.api.ApplicationFile;
import com.yahoo.container.jdisc.HttpResponse;
-import org.apache.commons.io.IOUtils;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import static com.yahoo.jdisc.http.HttpResponse.Status.*;
+import static com.yahoo.jdisc.http.HttpResponse.Status.OK;
/**
* Represents a response for a request to read contents of a file.
@@ -28,7 +27,7 @@ public class SessionContentReadResponse extends HttpResponse {
@Override
public void render(OutputStream outputStream) throws IOException {
try (InputStream inputStream = file.createInputStream()) {
- IOUtils.copyLarge(inputStream, outputStream, new byte[1]);
+ inputStream.transferTo(outputStream);
}
}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/StaticResponse.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/StaticResponse.java
index 707ba6e361e..d027d08eda5 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/StaticResponse.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/StaticResponse.java
@@ -2,7 +2,6 @@
package com.yahoo.vespa.config.server.http;
import com.yahoo.container.jdisc.HttpResponse;
-import org.apache.commons.io.IOUtils;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -29,7 +28,7 @@ public class StaticResponse extends HttpResponse {
@Override
public void render(OutputStream outputStream) throws IOException {
- IOUtils.copy(body, outputStream);
+ body.transferTo(outputStream);
body.close();
}
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionContentHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionContentHandlerTest.java
index 01c6631111e..a106f52e4d1 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionContentHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionContentHandlerTest.java
@@ -1,10 +1,10 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.http.v2;
-import com.google.common.io.Files;
import com.yahoo.config.model.application.provider.FilesApplicationPackage;
import com.yahoo.config.provision.TenantName;
import com.yahoo.container.jdisc.HttpResponse;
+import com.yahoo.io.IOUtils;
import com.yahoo.jdisc.Response;
import com.yahoo.jdisc.http.HttpRequest;
import com.yahoo.text.Utf8;
@@ -15,7 +15,6 @@ import com.yahoo.vespa.config.server.http.ContentHandlerTestBase;
import com.yahoo.vespa.config.server.http.SessionHandlerTest;
import com.yahoo.vespa.config.server.tenant.TenantBuilder;
import com.yahoo.vespa.config.server.tenant.TenantRepository;
-import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -24,6 +23,7 @@ import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.file.Files;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertNotNull;
@@ -145,8 +145,8 @@ public class SessionContentHandlerTest extends ContentHandlerTestBase {
}
private File createTestApp() throws IOException {
- File testApp = Files.createTempDir();
- FileUtils.copyDirectory(new File("src/test/apps/content"), testApp);
+ File testApp = Files.createTempDirectory("session-content-handler-test-app").toFile();
+ IOUtils.copyDirectory(new File("src/test/apps/content"), testApp);
return testApp;
}