File tree Expand file tree Collapse file tree 5 files changed +20
-25
lines changed
Filter options
src/main/java/io/fabric8/maven/docker Expand file tree Collapse file tree 5 files changed +20
-25
lines changed
Original file line number Diff line number Diff line change 2
2
3
3
import java .io .File ;
4
4
import java .io .IOException ;
5
- import java .util .Date ;
6
- import java .util .List ;
7
- import java .util .Map ;
8
- import java .util .Properties ;
5
+ import java .util .*;
9
6
import java .util .regex .Matcher ;
10
7
import java .util .regex .Pattern ;
11
8
import java .util .stream .Collectors ;
12
9
13
- import com .google .common .collect .ImmutableList ;
14
10
import io .fabric8 .maven .docker .access .DockerAccess ;
15
11
import io .fabric8 .maven .docker .access .DockerAccessException ;
16
12
import io .fabric8 .maven .docker .access .ExecException ;
@@ -501,8 +497,9 @@ protected LogDispatcher getLogDispatcher(ServiceHub hub) {
501
497
return dispatcher ;
502
498
}
503
499
504
- private ImmutableList <ImageConfiguration > getAllImages () {
505
- ImmutableList .Builder <ImageConfiguration > allImages = ImmutableList .builder ();
500
+ private List <ImageConfiguration > getAllImages () {
501
+ List <ImageConfiguration > allImages = new ArrayList <>();
502
+
506
503
if (images != null ) {
507
504
allImages .addAll (images );
508
505
}
@@ -514,7 +511,7 @@ private ImmutableList<ImageConfiguration> getAllImages() {
514
511
allImages .add (config );
515
512
});
516
513
}
517
- return allImages . build ( );
514
+ return Collections . unmodifiableList ( allImages );
518
515
}
519
516
520
517
public ImagePullManager getImagePullManager (String imagePullPolicy , String autoPull ) {
Original file line number Diff line number Diff line change 1
1
package io .fabric8 .maven .docker .util ;
2
2
3
- import java .util .ArrayList ;
4
- import java .util .Collection ;
5
- import java .util .Date ;
6
- import java .util .HashMap ;
7
- import java .util .Map ;
8
- import java .util .Set ;
3
+ import java .util .*;
9
4
import java .util .function .Function ;
10
5
import java .util .stream .Collectors ;
11
6
12
- import com .google .common .collect .ImmutableSet ;
13
7
import io .fabric8 .maven .docker .config .ImageConfiguration ;
14
8
import io .fabric8 .maven .docker .config .RunImageConfiguration ;
15
9
import io .fabric8 .maven .docker .model .Container ;
@@ -164,11 +158,12 @@ private static Collection<Container> keepOnlyLastIndexedContainer(Collection<Con
164
158
}
165
159
166
160
private static Set <String > extractContainerNames (final Collection <Container > existingContainers ) {
167
- final ImmutableSet . Builder <String > containerNamesBuilder = ImmutableSet . builder ();
161
+ final Set <String > containerNamesBuilder = new HashSet <> ();
168
162
for (final Container container : existingContainers ) {
169
163
containerNamesBuilder .add (container .getName ());
170
164
}
171
- return containerNamesBuilder .build ();
165
+
166
+ return Collections .unmodifiableSet (containerNamesBuilder );
172
167
}
173
168
174
169
private static String extractContainerNamePattern (ImageConfiguration image , String defaultContainerNamePattern ) {
Original file line number Diff line number Diff line change 1
1
package io .fabric8 .maven .docker .util ;
2
2
3
- import com .google .common .base .Joiner ;
4
- import com .google .common .collect .Lists ;
5
3
import com .google .gson .JsonObject ;
6
4
7
5
import org .apache .maven .plugin .MojoExecutionException ;
8
6
9
7
import java .io .IOException ;
8
+ import java .util .LinkedList ;
10
9
import java .util .List ;
11
10
12
11
import io .fabric8 .maven .docker .access .AuthConfig ;
@@ -93,7 +92,7 @@ public String getVersion() throws IOException {
93
92
// echo <registryToLookup> | docker-credential-XXX get
94
93
private class GetCommand extends ExternalCommand {
95
94
96
- private List <String > reply = Lists . newLinkedList ();
95
+ private final List <String > reply = new LinkedList <> ();
97
96
98
97
GetCommand () {
99
98
super (CredentialHelperClient .this .log );
@@ -119,9 +118,10 @@ public JsonObject getCredentialNode(String registryToLookup) throws IOException
119
118
throw ex ;
120
119
}
121
120
}
122
- JsonObject credentials = JsonFactory .newJsonObject (Joiner .on ('\n' ).join (reply ));
121
+ String joinedReply = String .join ("\n " , reply );
122
+ JsonObject credentials = JsonFactory .newJsonObject (joinedReply );
123
123
if (!credentials .has (SECRET_KEY ) || !credentials .has (USERNAME_KEY )) {
124
- return null ;
124
+ return null ; // If keys are missing, return null
125
125
}
126
126
return credentials ;
127
127
}
Original file line number Diff line number Diff line change 20
20
import java .util .Date ;
21
21
import java .util .HashMap ;
22
22
import java .util .Map ;
23
+ import java .util .Objects ;
23
24
24
- import com .google .common .base .Strings ;
25
25
import io .fabric8 .maven .docker .config .ConfigHelper ;
26
26
import org .apache .maven .project .MavenProject ;
27
27
@@ -178,7 +178,7 @@ public String doTransform(String tag, Date now) {
178
178
179
179
public String transform (MavenProject project , String tag , Date now ) {
180
180
// In case the Maven property is also a placeholder, replace it as well
181
- if ( Strings . isNullOrEmpty (tag ) || tag .equals ("%" + letter )) {
181
+ if ( isNullorEmpty (tag ) || tag .equals ("%" + letter )) {
182
182
tag = project .getVersion ();
183
183
}
184
184
return doTransform (tag , now );
@@ -248,4 +248,8 @@ private static String sanitizeName(String name) {
248
248
// All characters must be lowercase
249
249
return ret .toString ().toLowerCase ();
250
250
}
251
+
252
+ private static boolean isNullorEmpty (String s ) {
253
+ return Objects .isNull (s ) || s .isEmpty ();
254
+ }
251
255
}
Original file line number Diff line number Diff line change 20
20
import io .fabric8 .maven .docker .config .Arguments ;
21
21
import io .fabric8 .maven .docker .config .BuildImageConfiguration ;
22
22
import io .fabric8 .maven .docker .config .ImageConfiguration ;
23
- import io .fabric8 .maven .docker .model .Image ;
24
23
import org .apache .commons .lang3 .StringUtils ;
25
24
26
25
import java .io .File ;
You can’t perform that action at this time.
0 commit comments