Skip to content

Commit f007e19

Browse files
author
Marcus Linke
committed
Merge branch 'camunda-ci-resultCallback-NPE't push origin master
2 parents 10c1040 + e3e0ed5 commit f007e19

5 files changed

Lines changed: 16 additions & 9 deletions

File tree

src/main/java/com/github/dockerjava/core/GoLangFileMatch.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424
* character class (must be non-empty)
2525
* c matches character c (c != '*', '?', '\\', '[')
2626
* '\\' c matches character c
27-
*
27+
*
2828
* character-range:
2929
* c matches character c (c != '\\', '-', ']')
3030
* '\\' c matches character c
3131
* lo '-' hi matches character c for lo <= c <= hi
32-
*
32+
*
3333
* Match requires pattern to match all of name, not just a substring.
3434
* The only possible returned error is ErrBadPattern, when pattern
3535
* is malformed.
36-
*
36+
*
3737
* On Windows, escaping is disabled. Instead, '\\' is treated as
3838
* path separator.
3939
* </pre>

src/main/java/com/github/dockerjava/core/command/BuildImageResultCallback.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ public String awaitImageId(long timeout, TimeUnit timeUnit) {
6262
}
6363

6464
private String getImageId() {
65-
if (latestItem == null || !latestItem.isBuildSuccessIndicated()) {
65+
if (latestItem == null) {
66+
throw new DockerClientException("Could not build image");
67+
} else if (!latestItem.isBuildSuccessIndicated()) {
6668
throw new DockerClientException("Could not build image: " + latestItem.getError());
6769
} else {
6870
return latestItem.getImageId();

src/main/java/com/github/dockerjava/core/command/PullImageResultCallback.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ public void awaitSuccess() {
4040
throw new DockerClientException("", e);
4141
}
4242

43-
if (latestItem == null || !latestItem.isPullSuccessIndicated()) {
43+
if (latestItem == null) {
44+
throw new DockerClientException("Could not pull image");
45+
} else if (!latestItem.isPullSuccessIndicated()) {
4446
throw new DockerClientException("Could not pull image: " + latestItem.getError());
4547
}
4648
}

src/main/java/com/github/dockerjava/core/command/PushImageResultCallback.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ public void awaitSuccess() {
4040
throw new DockerClientException("", e);
4141
}
4242

43-
if (latestItem == null || latestItem.isErrorIndicated()) {
43+
if (latestItem == null) {
44+
throw new DockerClientException("Could not push image");
45+
} else if (latestItem.isErrorIndicated()) {
4446
throw new DockerClientException("Could not push image: " + latestItem.getError());
4547
}
4648
}

src/main/java/com/github/dockerjava/core/dockerfile/Dockerfile.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ private List<String> matchingIgnorePatterns(String fileName) {
206206
}
207207

208208
/**
209-
* Returns the matching ignore pattern for the given file or null if it should NOT be ignored.
210-
* Exception rules like "!Dockerfile" will be respected.
209+
* Returns the matching ignore pattern for the given file or null if it should NOT be ignored. Exception rules
210+
* like "!Dockerfile" will be respected.
211211
*/
212212
private String effectiveMatchingIgnorePattern(File file) {
213213
String relativeFilename = FilePathUtil.relativize(getDockerFolder(), file);
@@ -221,7 +221,8 @@ private String effectiveMatchingIgnorePattern(File file) {
221221

222222
int lastMatchingPatternIndex = ignores.lastIndexOf(lastMatchingPattern);
223223

224-
if(lastMatchingPatternIndex == ignores.size() - 1) return lastMatchingPattern;
224+
if (lastMatchingPatternIndex == ignores.size() - 1)
225+
return lastMatchingPattern;
225226

226227
List<String> remainingIgnorePattern = ignores.subList(lastMatchingPatternIndex + 1, ignores.size());
227228

0 commit comments

Comments
 (0)