File tree Expand file tree Collapse file tree
src/main/java/com/github/dockerjava/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,12 +16,9 @@ public class DockerClientBuilder {
1616 static {
1717 serviceLoader .reload ();
1818 Iterator <DockerCmdExecFactory > iterator = serviceLoader .iterator ();
19- if (!iterator .hasNext ()) {
20- throw new RuntimeException ("Fatal: Can't find any implementation of '"
21- + DockerCmdExecFactory .class .getName () + "' in the current classpath." );
19+ if (iterator .hasNext ()) {
20+ factoryClass = iterator .next ().getClass ();
2221 }
23-
24- factoryClass = iterator .next ().getClass ();
2522 }
2623
2724 private DockerClientImpl dockerClient = null ;
@@ -49,6 +46,11 @@ public static DockerClientBuilder getInstance(String serverUrl) {
4946 }
5047
5148 public static DockerCmdExecFactory getDefaultDockerCmdExecFactory () {
49+ if (factoryClass == null ) {
50+ throw new RuntimeException ("Fatal: Can't find any implementation of '"
51+ + DockerCmdExecFactory .class .getName () + "' in the current classpath." );
52+ }
53+
5254 try {
5355 return factoryClass .newInstance ();
5456 } catch (InstantiationException | IllegalAccessException e ) {
You can’t perform that action at this time.
0 commit comments