GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Relax protocol check in `DefaultDockerClientConfig` (#1818) · ConnorLinfoot/docker-java@ddfaf56

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • docker-java-core/src/main/java/com/github/dockerjava/core
    • DefaultDockerClientConfig.java
  • docker-java-transport-httpclient5/src/main/java/com/github/dockerjava/httpclient5
    • ApacheDockerHttpClientImpl.java
  • docker-java-transport-okhttp/src/main/java/com/github/dockerjava/okhttp
    • OkDockerHttpClient.java
  • docker-java/src/test/java/com/github/dockerjava/core
    • DefaultDockerClientConfigTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎docker-java-core/src/main/java/com/github/dockerjava/core/DefaultDockerClientConfig.java‎

Copy file name to clipboardExpand all lines: docker-java-core/src/main/java/com/github/dockerjava/core/DefaultDockerClientConfig.java
+1-9Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.net.URI;
2323
import java.util.HashSet;
2424
import java.util.Map;
25-
import java.util.Objects;
2625
import java.util.Properties;
2726
import java.util.Set;
2827

@@ -106,14 +105,7 @@ private URI checkDockerHostScheme(URI dockerHost) {
106105
if (dockerHost == null) {
107106
throw new DockerClientException("'dockerHost' is null");
108107
}
109-
switch (Objects.toString(dockerHost.getScheme())) {
110-
case "tcp":
111-
case "unix":
112-
case "npipe":
113-
return dockerHost;
114-
default:
115-
throw new DockerClientException("Unsupported protocol scheme found: '" + dockerHost);
116-
}
108+
return dockerHost;
117109
}
118110

119111
private static Properties loadIncludedDockerProperties(Properties systemProperties) {
Collapse file

‎docker-java-transport-httpclient5/src/main/java/com/github/dockerjava/httpclient5/ApacheDockerHttpClientImpl.java‎

Copy file name to clipboardExpand all lines: docker-java-transport-httpclient5/src/main/java/com/github/dockerjava/httpclient5/ApacheDockerHttpClientImpl.java
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ protected ApacheDockerHttpClientImpl(
8080
);
8181
break;
8282
default:
83-
pathPrefix = "";
84-
host = HttpHost.create(dockerHost);
83+
throw new IllegalArgumentException("Unsupported protocol scheme: " + dockerHost);
8584
}
8685

8786
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(
Collapse file

‎docker-java-transport-okhttp/src/main/java/com/github/dockerjava/okhttp/OkDockerHttpClient.java‎

Copy file name to clipboardExpand all lines: docker-java-transport-okhttp/src/main/java/com/github/dockerjava/okhttp/OkDockerHttpClient.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ private OkDockerHttpClient(
175175
}
176176
break;
177177
default:
178-
baseUrlBuilder = HttpUrl.get(dockerHost.toString()).newBuilder();
178+
throw new IllegalArgumentException("Unsupported protocol scheme: " + dockerHost);
179179
}
180180
baseUrl = baseUrlBuilder.build();
181181
}
Collapse file

‎docker-java/src/test/java/com/github/dockerjava/core/DefaultDockerClientConfigTest.java‎

Copy file name to clipboardExpand all lines: docker-java/src/test/java/com/github/dockerjava/core/DefaultDockerClientConfigTest.java
+5-21Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import java.util.HashMap;
1616
import java.util.Map;
1717
import java.util.Properties;
18+
import java.util.UUID;
1819

1920
import static org.hamcrest.MatcherAssert.assertThat;
2021
import static org.hamcrest.Matchers.equalTo;
@@ -172,28 +173,11 @@ public void testTlsVerifyAndCertPath() throws Exception {
172173
new LocalDirectorySSLConfig(dockerCertPath()));
173174
}
174175

175-
@Test(expected = DockerClientException.class)
176-
public void testWrongHostScheme() throws Exception {
177-
new DefaultDockerClientConfig(URI.create("http://foo"), "dockerConfig", "apiVersion", "registryUrl", "registryUsername", "registryPassword", "registryEmail",
178-
null);
179-
}
180-
181176
@Test()
182-
public void testTcpHostScheme() throws Exception {
183-
new DefaultDockerClientConfig(URI.create("tcp://foo"), "dockerConfig", "apiVersion", "registryUrl", "registryUsername", "registryPassword", "registryEmail",
184-
null);
185-
}
186-
187-
@Test()
188-
public void testUnixHostScheme() throws Exception {
189-
new DefaultDockerClientConfig(URI.create("unix://foo"), "dockerConfig", "apiVersion", "registryUrl", "registryUsername", "registryPassword", "registryEmail",
190-
null);
191-
}
192-
193-
@Test()
194-
public void testNpipeHostScheme() throws Exception {
195-
new DefaultDockerClientConfig(URI.create("npipe://foo"), "dockerConfig", "apiVersion", "registryUrl", "registryUsername", "registryPassword", "registryEmail",
196-
null);
177+
public void testAnyHostScheme() throws Exception {
178+
URI dockerHost = URI.create(UUID.randomUUID().toString().replace("-", "") + "://foo");
179+
new DefaultDockerClientConfig(dockerHost, "dockerConfig", "apiVersion", "registryUrl", "registryUsername", "registryPassword", "registryEmail",
180+
null);
197181
}
198182

199183
@Test

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.