@@ -277,7 +277,7 @@ protected DefaultDockerClient(final Builder builder) {
277
277
278
278
@ VisibleForTesting
279
279
DefaultDockerClient (final Builder builder , Supplier <ClientBuilder > clientBuilderSupplier ) {
280
- URI originalUri = checkNotNull (builder .uri , "uri" );
280
+ final URI originalUri = checkNotNull (builder .uri , "uri" );
281
281
this .apiVersion = builder .apiVersion ();
282
282
283
283
if ((builder .dockerCertificates != null ) && !originalUri .getScheme ().equals ("https" )) {
@@ -400,7 +400,7 @@ public List<Container> listContainers(final ListContainersParam... params)
400
400
.path ("containers" ).path ("json" );
401
401
402
402
final Map <String , List <String >> filters = newHashMap ();
403
- for (ListContainersParam param : params ) {
403
+ for (final ListContainersParam param : params ) {
404
404
if (param instanceof ListContainersFilterParam ) {
405
405
List <String > filterValueList ;
406
406
if (filters .containsKey (param .name ())) {
@@ -467,9 +467,9 @@ public List<Image> listImages(final ListImagesParam... params)
467
467
.path ("images" ).path ("json" );
468
468
469
469
final Map <String , List <String >> filters = newHashMap ();
470
- for (ListImagesParam param : params ) {
470
+ for (final ListImagesParam param : params ) {
471
471
if (param instanceof ListImagesFilterParam ) {
472
- List <String > filterValueList ;
472
+ final List <String > filterValueList ;
473
473
if (filters .containsKey (param .name ())) {
474
474
filterValueList = filters .get (param .name ());
475
475
} else {
@@ -686,7 +686,7 @@ public InputStream copyContainer(String containerId, String path)
686
686
.path ("containers" ).path (containerId ).path ("copy" );
687
687
688
688
// Internal JSON object; not worth it to create class for this
689
- JsonNodeFactory nf = JsonNodeFactory .instance ;
689
+ final JsonNodeFactory nf = JsonNodeFactory .instance ;
690
690
final JsonNode params = nf .objectNode ().set ("Resource" , nf .textNode (path ));
691
691
692
692
return request (POST , InputStream .class , resource ,
@@ -704,11 +704,9 @@ public void copyToContainer(final Path directory, String containerId, String pat
704
704
.queryParam ("noOverwriteDirNonDir" , true )
705
705
.queryParam ("path" , path );
706
706
707
- CompressedDirectory compressedDirectory
708
- = CompressedDirectory .create (directory );
707
+ final CompressedDirectory compressedDirectory = CompressedDirectory .create (directory );
709
708
710
- final InputStream fileStream =
711
- Files .newInputStream (compressedDirectory .file ());
709
+ final InputStream fileStream = Files .newInputStream (compressedDirectory .file ());
712
710
713
711
request (PUT , String .class , resource ,
714
712
resource .request (APPLICATION_OCTET_STREAM_TYPE ),
@@ -845,9 +843,10 @@ public void load(final String image, final InputStream imagePayload,
845
843
.queryParam ("fromSrc" , "-" )
846
844
.queryParam ("tag" , image );
847
845
848
- LoadProgressHandler loadProgressHandler = new LoadProgressHandler (handler );
849
- Entity <InputStream > entity = Entity .entity (imagePayload , MediaType .APPLICATION_OCTET_STREAM );
850
- try (ProgressStream load =
846
+ final LoadProgressHandler loadProgressHandler = new LoadProgressHandler (handler );
847
+ final Entity <InputStream > entity = Entity .entity (imagePayload ,
848
+ MediaType .APPLICATION_OCTET_STREAM );
849
+ try (final ProgressStream load =
851
850
request (POST , ProgressStream .class , resource ,
852
851
resource
853
852
.request (APPLICATION_JSON_TYPE )
@@ -870,7 +869,7 @@ public InputStream save(final String image)
870
869
@ Override
871
870
public InputStream save (final String image , final AuthConfig authConfig )
872
871
throws DockerException , IOException , InterruptedException {
873
- WebTarget resource = resource ().path ("images" ).path (image ).path ("get" );
872
+ final WebTarget resource = resource ().path ("images" ).path (image ).path ("get" );
874
873
875
874
return request (
876
875
GET ,
@@ -1108,7 +1107,7 @@ public LogStream logs(final String containerId, final LogsParam... params)
1108
1107
.path ("containers" ).path (containerId )
1109
1108
.path ("logs" );
1110
1109
1111
- for (LogsParam param : params ) {
1110
+ for (final LogsParam param : params ) {
1112
1111
resource = resource .queryParam (param .name (), param .value ());
1113
1112
}
1114
1113
@@ -1120,7 +1119,7 @@ public EventStream events(EventsParam... params)
1120
1119
throws DockerException , InterruptedException {
1121
1120
WebTarget resource = noTimeoutResource ().path ("events" );
1122
1121
final Map <String , String > filters = newHashMap ();
1123
- for (EventsParam param : params ) {
1122
+ for (final EventsParam param : params ) {
1124
1123
if (param instanceof EventsFilterParam ) {
1125
1124
filters .put (param .name (), param .value ());
1126
1125
} else {
@@ -1133,7 +1132,7 @@ public EventStream events(EventsParam... params)
1133
1132
final StringWriter writer = new StringWriter ();
1134
1133
final JsonGenerator generator = objectMapper ().getFactory ().createGenerator (writer );
1135
1134
generator .writeStartObject ();
1136
- for (Map .Entry <String , String > entry : filters .entrySet ()) {
1135
+ for (final Map .Entry <String , String > entry : filters .entrySet ()) {
1137
1136
generator .writeArrayFieldStart (entry .getKey ());
1138
1137
generator .writeString (entry .getValue ());
1139
1138
generator .writeEndArray ();
@@ -1149,9 +1148,9 @@ public EventStream events(EventsParam... params)
1149
1148
}
1150
1149
1151
1150
try {
1152
- CloseableHttpClient client = (CloseableHttpClient ) ApacheConnectorProvider
1151
+ final CloseableHttpClient client = (CloseableHttpClient ) ApacheConnectorProvider
1153
1152
.getHttpClient (noTimeoutClient );
1154
- CloseableHttpResponse response = client .execute (new HttpGet (resource .getUri ()));
1153
+ final CloseableHttpResponse response = client .execute (new HttpGet (resource .getUri ()));
1155
1154
return new EventStream (response , objectMapper ());
1156
1155
} catch (IOException exception ) {
1157
1156
throw new DockerException (exception );
@@ -1192,7 +1191,7 @@ public String execCreate(final String containerId,
1192
1191
final String [] cmd ,
1193
1192
final ExecCreateParam ... params )
1194
1193
throws DockerException , InterruptedException {
1195
- WebTarget resource = resource ().path ("containers" ).path (containerId ).path ("exec" );
1194
+ final WebTarget resource = resource ().path ("containers" ).path (containerId ).path ("exec" );
1196
1195
1197
1196
final StringWriter writer = new StringWriter ();
1198
1197
try {
@@ -1233,7 +1232,7 @@ public String execCreate(final String containerId,
1233
1232
}
1234
1233
1235
1234
try {
1236
- JsonNode json = objectMapper ().readTree (response );
1235
+ final JsonNode json = objectMapper ().readTree (response );
1237
1236
return json .findValue ("Id" ).textValue ();
1238
1237
} catch (IOException e ) {
1239
1238
throw new DockerException (e );
@@ -1244,14 +1243,14 @@ public String execCreate(final String containerId,
1244
1243
@ Override
1245
1244
public LogStream execStart (final String execId , final ExecStartParameter ... params )
1246
1245
throws DockerException , InterruptedException {
1247
- WebTarget resource = resource ().path ("exec" ).path (execId ).path ("start" );
1246
+ final WebTarget resource = resource ().path ("exec" ).path (execId ).path ("start" );
1248
1247
1249
1248
final StringWriter writer = new StringWriter ();
1250
1249
try {
1251
1250
final JsonGenerator generator = objectMapper ().getFactory ().createGenerator (writer );
1252
1251
generator .writeStartObject ();
1253
1252
1254
- for (ExecStartParameter param : params ) {
1253
+ for (final ExecStartParameter param : params ) {
1255
1254
generator .writeBooleanField (param .getName (), true );
1256
1255
}
1257
1256
@@ -1277,7 +1276,7 @@ public LogStream execStart(final String execId, final ExecStartParameter... para
1277
1276
1278
1277
@ Override
1279
1278
public ExecState execInspect (final String execId ) throws DockerException , InterruptedException {
1280
- WebTarget resource = resource ().path ("exec" ).path (execId ).path ("json" );
1279
+ final WebTarget resource = resource ().path ("exec" ).path (execId ).path ("json" );
1281
1280
1282
1281
try {
1283
1282
return request (GET , ExecState .class , resource , resource .request (APPLICATION_JSON_TYPE ));
@@ -1370,9 +1369,9 @@ private void manageNetworkConnection(String containerId, String methodname, Stri
1370
1369
throws DockerException , InterruptedException {
1371
1370
final WebTarget resource = resource ().path ("networks" ).path (networkId ).path (methodname );
1372
1371
1373
- Map <String , String > request = new HashMap <>();
1372
+ final Map <String , String > request = new HashMap <>();
1374
1373
request .put ("Container" , containerId );
1375
- Response response =
1374
+ final Response response =
1376
1375
request (POST , Response .class , resource , resource .request (APPLICATION_JSON_TYPE ),
1377
1376
Entity .json (request ));
1378
1377
switch (response .getStatus ()) {
@@ -1444,9 +1443,9 @@ private void request(final String method,
1444
1443
}
1445
1444
1446
1445
private Invocation .Builder headers (final Invocation .Builder request ) {
1447
- Set <Map .Entry <String , Object >> entries = headers .entrySet ();
1446
+ final Set <Map .Entry <String , Object >> entries = headers .entrySet ();
1448
1447
1449
- for (Map .Entry <String , Object > entry : entries ) {
1448
+ for (final Map .Entry <String , Object > entry : entries ) {
1450
1449
request .header (entry .getKey (), entry .getValue ());
1451
1450
}
1452
1451
@@ -1537,7 +1536,7 @@ private String authRegistryHeader(final AuthRegistryConfig authRegistryConfig)
1537
1536
}
1538
1537
1539
1538
log .debug ("Registry Config Json {}" , authRegistryJson );
1540
- String authRegistryEncoded = Base64 .encodeAsString (authRegistryJson );
1539
+ final String authRegistryEncoded = Base64 .encodeAsString (authRegistryJson );
1541
1540
log .debug ("Registry Config Encoded {}" , authRegistryEncoded );
1542
1541
return authRegistryEncoded ;
1543
1542
} catch (JsonProcessingException | InterruptedException ex ) {
0 commit comments