Skip to content

Commit dcc9416

Browse files
authored
Remove usages of Commons Compress (#1079)
1 parent 057a518 commit dcc9416

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/main/java/io/jenkins/docker/connector/DockerComputerSSHConnector.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
import java.util.stream.Stream;
5555
import jenkins.bouncycastle.api.PEMEncodable;
5656
import jenkins.model.Jenkins;
57-
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
58-
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
57+
import org.apache.tools.tar.TarEntry;
58+
import org.apache.tools.tar.TarOutputStream;
5959
import org.jenkinsci.Symbol;
6060
import org.jenkinsci.main.modules.instance_identity.InstanceIdentity;
6161
import org.kohsuke.accmod.Restricted;
@@ -298,13 +298,13 @@ public void beforeContainerStarted(DockerAPI api, String workdir, DockerTransien
298298
+ "|| :";
299299
final byte[] authorizedKeysCommandAsBytes = authorizedKeysCommand.getBytes(StandardCharsets.UTF_8);
300300
try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
301-
TarArchiveOutputStream tar = new TarArchiveOutputStream(bos)) {
302-
TarArchiveEntry entry = new TarArchiveEntry("authorized_key");
301+
TarOutputStream tar = new TarOutputStream(bos)) {
302+
TarEntry entry = new TarEntry("authorized_key");
303303
entry.setSize(authorizedKeysCommandAsBytes.length);
304304
entry.setMode(0700);
305-
tar.putArchiveEntry(entry);
305+
tar.putNextEntry(entry);
306306
tar.write(authorizedKeysCommandAsBytes);
307-
tar.closeArchiveEntry();
307+
tar.closeEntry();
308308
tar.close();
309309
try (InputStream is = new ByteArrayInputStream(bos.toByteArray());
310310
DockerClient client = api.getClient()) {

0 commit comments

Comments
 (0)