1313import java .net .URI ;
1414import java .util .HashMap ;
1515import java .util .Map ;
16+ import java .util .Objects ;
1617import java .util .Set ;
1718
18- import static com .google .common .base .Preconditions .checkNotNull ;
19-
2019/**
2120 * Build an image from Dockerfile.
2221 */
@@ -79,7 +78,7 @@ public BuildImageCmdImpl(BuildImageCmd.Exec exec) {
7978
8079 public BuildImageCmdImpl (BuildImageCmd .Exec exec , File dockerFileOrFolder ) {
8180 super (exec );
82- checkNotNull (dockerFileOrFolder , "dockerFolder is null" );
81+ Objects . requireNonNull (dockerFileOrFolder , "dockerFolder is null" );
8382
8483 if (dockerFileOrFolder .isDirectory ()) {
8584 withBaseDirectory (dockerFileOrFolder );
@@ -91,7 +90,7 @@ public BuildImageCmdImpl(BuildImageCmd.Exec exec, File dockerFileOrFolder) {
9190
9291 public BuildImageCmdImpl (BuildImageCmd .Exec exec , InputStream tarInputStream ) {
9392 super (exec );
94- checkNotNull (tarInputStream , "tarInputStream is null" );
93+ Objects . requireNonNull (tarInputStream , "tarInputStream is null" );
9594 withTarInputStream (tarInputStream );
9695 }
9796
@@ -232,8 +231,7 @@ public Set<String> getExtraHosts() {
232231 @ Deprecated
233232 @ Override
234233 public BuildImageCmdImpl withTag (String tag ) {
235- checkNotNull (tag , "Tag is null" );
236- this .tag = tag ;
234+ this .tag = Objects .requireNonNull (tag , "Tag is null" );
237235 return this ;
238236 }
239237
@@ -328,7 +326,7 @@ public BuildImageCmd withBaseDirectory(File baseDirectory) {
328326
329327 @ Override
330328 public BuildImageCmdImpl withDockerfile (File dockerfile ) {
331- checkNotNull (dockerfile );
329+ Objects . requireNonNull (dockerfile );
332330 if (!dockerfile .exists ()) {
333331 throw new IllegalArgumentException ("Dockerfile does not exist" );
334332 }
@@ -353,22 +351,19 @@ public BuildImageCmdImpl withDockerfile(File dockerfile) {
353351
354352 @ Override
355353 public BuildImageCmd withDockerfilePath (String dockerfilePath ) {
356- checkNotNull (dockerfilePath , "dockerfilePath is null" );
357- this .dockerFilePath = dockerfilePath ;
354+ this .dockerFilePath = Objects .requireNonNull (dockerfilePath , "dockerfilePath is null" );
358355 return this ;
359356 }
360357
361358 @ Override
362359 public BuildImageCmdImpl withTarInputStream (InputStream tarInputStream ) {
363- checkNotNull (tarInputStream , "tarInputStream is null" );
364- this .tarInputStream = tarInputStream ;
360+ this .tarInputStream = Objects .requireNonNull (tarInputStream , "tarInputStream is null" );
365361 return this ;
366362 }
367363
368364 @ Override
369365 public BuildImageCmd withBuildAuthConfigs (AuthConfigurations authConfigs ) {
370- checkNotNull (authConfigs , "authConfig is null" );
371- this .buildAuthConfigs = authConfigs ;
366+ this .buildAuthConfigs = Objects .requireNonNull (authConfigs , "authConfig is null" );
372367 return this ;
373368 }
374369
0 commit comments