File tree Expand file tree Collapse file tree
src/main/java/com/github/dockerjava/api/model Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,16 +19,18 @@ public class BuildResponseItem extends ResponseItem {
1919 */
2020 @ JsonIgnore
2121 public boolean isBuildSuccessIndicated () {
22- if (getStream () == null )
22+ if (isErrorIndicated () || getStream () == null ) {
2323 return false ;
24+ }
2425
2526 return getStream ().contains (BUILD_SUCCESS );
2627 }
2728
2829 @ JsonIgnore
2930 public String getImageId () {
30- if (!isBuildSuccessIndicated ())
31+ if (!isBuildSuccessIndicated ()) {
3132 return null ;
33+ }
3234
3335 return getStream ().replaceFirst (BUILD_SUCCESS , "" ).trim ();
3436 }
Original file line number Diff line number Diff line change @@ -18,8 +18,9 @@ public class PullResponseItem extends ResponseItem {
1818 */
1919 @ JsonIgnore
2020 public boolean isPullSuccessIndicated () {
21- if (getStatus () == null )
21+ if (isErrorIndicated () || getStatus () == null ) {
2222 return false ;
23+ }
2324
2425 return (getStatus ().contains ("Download complete" ) || getStatus ().contains ("Image is up to date" ) || getStatus ()
2526 .contains ("Downloaded newer image" ));
Original file line number Diff line number Diff line change @@ -11,16 +11,4 @@ public class PushResponseItem extends ResponseItem {
1111
1212 private static final long serialVersionUID = 8256977108011295857L ;
1313
14- /**
15- * Returns whether the error field indicates an error
16- *
17- * @returns true: the error field indicates an error, false: the error field doesn't indicate an error
18- */
19- @ JsonIgnore
20- public boolean isErrorIndicated () {
21- if (getError () == null && getErrorDetail () == null )
22- return false ;
23-
24- return true ;
25- }
2614}
Original file line number Diff line number Diff line change 22
33import java .io .Serializable ;
44
5+ import com .fasterxml .jackson .annotation .JsonIgnore ;
56import org .apache .commons .lang .builder .ToStringBuilder ;
67import org .apache .commons .lang .builder .ToStringStyle ;
78
@@ -25,6 +26,7 @@ public class ResponseItem implements Serializable {
2526 @ JsonProperty ("progressDetail" )
2627 private ProgressDetail progressDetail ;
2728
29+ @ Deprecated
2830 @ JsonProperty ("progress" )
2931 private String progress ;
3032
@@ -40,6 +42,7 @@ public class ResponseItem implements Serializable {
4042 @ JsonProperty ("errorDetail" )
4143 private ErrorDetail errorDetail ;
4244
45+ @ Deprecated
4346 @ JsonProperty ("error" )
4447 private String error ;
4548
@@ -81,6 +84,17 @@ public String getError() {
8184 return error ;
8285 }
8386
87+ /**
88+ * Returns whether the error field indicates an error
89+ *
90+ * @returns true: the error field indicates an error, false: the error field doesn't indicate an error
91+ */
92+ @ JsonIgnore
93+ public boolean isErrorIndicated () {
94+ // check both the deprecated and current error fields, just in case
95+ return getError () != null || getErrorDetail () != null ;
96+ }
97+
8498 @ JsonIgnoreProperties (ignoreUnknown = false )
8599 public static class ProgressDetail implements Serializable {
86100 private static final long serialVersionUID = -1954994695645715264L ;
You can’t perform that action at this time.
0 commit comments