Skip to content
This repository has been archived by the owner on Nov 6, 2018. It is now read-only.

Removed dependency on commons-codec #108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
Expand Down
5 changes: 2 additions & 3 deletions client/src/main/java/io/fabric8/docker/client/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import io.fabric8.docker.client.utils.Utils;
import io.sundr.builder.annotations.Buildable;
import io.sundr.builder.annotations.Inline;
import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -40,6 +39,7 @@
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.xml.bind.DatatypeConverter;

import static io.fabric8.docker.client.utils.Utils.getSystemPropertyOrEnvVar;
import static io.fabric8.docker.client.utils.Utils.hasSystemPropertyOrEnvVar;
Expand Down Expand Up @@ -225,8 +225,7 @@ private boolean tryDockerConfig(Config config) {
String serverAddress = entry.getKey();
AuthConfig authConfig = entry.getValue();
if (authConfig.getAuth() != null) {
String auth = new String(Base64.decodeBase64(authConfig.getAuth().getBytes(UTF_8)), UTF_8);
Matcher m = AUTH_PATTERN.matcher(auth);
Matcher m = AUTH_PATTERN.matcher(DatatypeConverter.printBase64Binary(authConfig.getAuth().getBytes(UTF_8)));
if (m.matches()) {
String username = m.group(USERNAME_LABEL);
String password = m.group(PASSWORD_LABEL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.xml.bind.DatatypeConverter;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;

Expand Down Expand Up @@ -261,7 +261,7 @@ public OutputHandle fromTar(String path) {

RequestBody body = RequestBody.create(MEDIA_TYPE_TAR, new File(path));
Request request = new Request.Builder()
.header("X-Registry-Config", new String(Base64.encodeBase64(JSON_MAPPER.writeValueAsString(config.getAuthConfigs()).getBytes("UTF-8")), "UTF-8"))
.header("X-Registry-Config", DatatypeConverter.printBase64Binary(JSON_MAPPER.writeValueAsString(config.getAuthConfigs()).getBytes("UTF-8")))
.post(body)
.url(sb.toString()).build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
import io.fabric8.docker.dsl.image.RedirectingWritingOutputTagAsRepoInterface;
import io.fabric8.docker.dsl.image.TagAsRepoInterface;
import io.fabric8.docker.dsl.image.UsingListenerRedirectingWritingOutputTagAsRepoInterface;
import org.apache.commons.codec.binary.Base64;

import java.io.OutputStream;
import java.io.PipedOutputStream;
import java.util.concurrent.TimeUnit;
import javax.xml.bind.DatatypeConverter;

public class ImportImage extends BaseImageOperation implements
UsingListenerRedirectingWritingOutputTagAsRepoInterface<OutputHandle>,
Expand Down Expand Up @@ -72,7 +72,7 @@ public OutputHandle asRepo(String src) {
}
AuthConfig authConfig = RegistryUtils.getConfigForImage(name, config);
Request request = new Request.Builder()
.header("X-Registry-Auth", new String(Base64.encodeBase64(JSON_MAPPER.writeValueAsString(authConfig != null ? authConfig : new AuthConfig()).getBytes("UTF-8")), "UTF-8"))
.header("X-Registry-Auth", DatatypeConverter.printBase64Binary(JSON_MAPPER.writeValueAsString(authConfig != null ? authConfig : new AuthConfig()).getBytes("UTF-8")))
.post(RequestBody.create(MEDIA_TYPE_TEXT, EMPTY))
.url(sb.toString()).build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
import io.fabric8.docker.dsl.image.RedirectingWritingOutputTagFromRegistryInterface;
import io.fabric8.docker.dsl.image.TagFromRegistryInterface;
import io.fabric8.docker.dsl.image.UsingListenerRedirectingWritingOutputTagFromRegistryInterface;
import org.apache.commons.codec.binary.Base64;

import java.io.OutputStream;
import java.io.PipedOutputStream;
import java.util.concurrent.TimeUnit;
import javax.xml.bind.DatatypeConverter;

public class PullImage extends BaseImageOperation implements
UsingListenerRedirectingWritingOutputTagFromRegistryInterface<OutputHandle>,
Expand Down Expand Up @@ -96,7 +96,7 @@ public OutputHandle fromRegistry() {

AuthConfig authConfig = RegistryUtils.getConfigForImage(name, config);
Request request = new Request.Builder()
.header("X-Registry-Auth", new String(Base64.encodeBase64(JSON_MAPPER.writeValueAsString(authConfig != null ? authConfig : new AuthConfig()).getBytes("UTF-8")), "UTF-8"))
.header("X-Registry-Auth", DatatypeConverter.printBase64Binary(JSON_MAPPER.writeValueAsString(authConfig != null ? authConfig : new AuthConfig()).getBytes("UTF-8")))
.post(RequestBody.create(MEDIA_TYPE_TEXT, EMPTY))
.url(sb.toString()).build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
import io.fabric8.docker.dsl.image.TagForceToRegistryInterface;
import io.fabric8.docker.dsl.image.ToRegistryInterface;
import io.fabric8.docker.dsl.image.UsingListenerRedirectingWritingOutputTagForceToRegistryInterface;
import org.apache.commons.codec.binary.Base64;

import java.io.OutputStream;
import java.io.PipedOutputStream;
import java.util.concurrent.TimeUnit;
import javax.xml.bind.DatatypeConverter;

public class PushImage extends BaseImageOperation implements
UsingListenerRedirectingWritingOutputTagForceToRegistryInterface<OutputHandle>,
Expand Down Expand Up @@ -77,7 +77,7 @@ public OutputHandle toRegistry() {
AuthConfig authConfig = RegistryUtils.getConfigForImage(name, config);
RequestBody body = RequestBody.create(MEDIA_TYPE_JSON, "{}");
Request request = new Request.Builder()
.header("X-Registry-Auth", new String(Base64.encodeBase64(JSON_MAPPER.writeValueAsString(authConfig != null ? authConfig : new AuthConfig()).getBytes("UTF-8")), "UTF-8"))
.header("X-Registry-Auth", DatatypeConverter.printBase64Binary(JSON_MAPPER.writeValueAsString(authConfig != null ? authConfig : new AuthConfig()).getBytes("UTF-8")))
.post(body)
.url(sb.toString()).build();

Expand Down
3 changes: 1 addition & 2 deletions platforms/karaf/features/src/main/resources/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<bundle dependency='true'>mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/${jackson.version}</bundle>
<bundle dependency='true'>mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/${jackson.version}</bundle>
<bundle dependency='true'>mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/${jackson.version}</bundle>
<bundle dependency="true">mvn:commons-codec/commons-codec/${commons-codec.version}</bundle>
<bundle dependency="true">mvn:org.apache.commons/commons-compress/${commons-compress.version}</bundle>
<bundle dependency="true">mvn:org.ow2.asm/asm/${asm.version}</bundle>
<bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.okio/${okio.bundle.version}</bundle>
Expand All @@ -36,4 +35,4 @@
<bundle>mvn:io.fabric8/docker-client/${project.version}/jar/bundle</bundle>
</feature>

</features>
</features>
6 changes: 0 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<commons-codec.version>1.10</commons-codec.version>
<commons-compress.version>1.9</commons-compress.version>
<easymock.version>3.2</easymock.version>
<felix.scr.annotations.version>1.9.8</felix.scr.annotations.version>
Expand Down Expand Up @@ -144,11 +143,6 @@

<dependencyManagement>
<dependencies>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons-codec.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
Expand Down