Skip to content

Commit d856518

Browse files
kgb-financial-comphilwebb
authored andcommitted
Accept Docker progress on numbers >2GB
Update `ProgressUpdateEvent` to support images of a file size >2GB without provoking build failures. See gh-43328
1 parent 86b7fe4 commit d856518

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ProgressUpdateEvent.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* An {@link UpdateEvent} that includes progress information.
2323
*
2424
* @author Phillip Webb
25+
* @author Wolfgang Kronberg
2526
* @since 2.3.0
2627
*/
2728
public abstract class ProgressUpdateEvent extends UpdateEvent {
@@ -67,12 +68,12 @@ public String getProgress() {
6768
*/
6869
public static class ProgressDetail {
6970

70-
private final Integer current;
71+
private final Long current;
7172

72-
private final Integer total;
73+
private final Long total;
7374

7475
@JsonCreator
75-
public ProgressDetail(Integer current, Integer total) {
76+
public ProgressDetail(Long current, Long total) {
7677
this.current = current;
7778
this.total = total;
7879
}
@@ -81,15 +82,15 @@ public ProgressDetail(Integer current, Integer total) {
8182
* Return the current progress value.
8283
* @return the current progress
8384
*/
84-
public int getCurrent() {
85+
public long getCurrent() {
8586
return this.current;
8687
}
8788

8889
/**
8990
* Return the total progress possible value.
9091
* @return the total progress possible
9192
*/
92-
public int getTotal() {
93+
public long getTotal() {
9394
return this.total;
9495
}
9596

spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/ProgressUpdateEventTests.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* @param <E> The event type
2929
* @author Phillip Webb
3030
* @author Scott Frederick
31+
* @author Wolfgang Kronberg
3132
*/
3233
abstract class ProgressUpdateEventTests<E extends ProgressUpdateEvent> {
3334

@@ -44,6 +45,13 @@ void getProgressDetailsReturnsProgressDetails() {
4445
assertThat(event.getProgressDetail().getTotal()).isEqualTo(2);
4546
}
4647

48+
@Test
49+
void getProgressDetailsReturnsProgressDetailsForLongNumbers() {
50+
ProgressUpdateEvent event = createEvent("status", new ProgressDetail(4000000000L, 8000000000L), "progress");
51+
assertThat(event.getProgressDetail().getCurrent()).isEqualTo(4000000000L);
52+
assertThat(event.getProgressDetail().getTotal()).isEqualTo(8000000000L);
53+
}
54+
4755
@Test
4856
void getProgressReturnsProgress() {
4957
ProgressUpdateEvent event = createEvent();
@@ -52,24 +60,24 @@ void getProgressReturnsProgress() {
5260

5361
@Test
5462
void progressDetailIsEmptyWhenCurrentIsNullReturnsTrue() {
55-
ProgressDetail detail = new ProgressDetail(null, 2);
63+
ProgressDetail detail = new ProgressDetail(null, 2L);
5664
assertThat(ProgressDetail.isEmpty(detail)).isTrue();
5765
}
5866

5967
@Test
6068
void progressDetailIsEmptyWhenTotalIsNullReturnsTrue() {
61-
ProgressDetail detail = new ProgressDetail(1, null);
69+
ProgressDetail detail = new ProgressDetail(1L, null);
6270
assertThat(ProgressDetail.isEmpty(detail)).isTrue();
6371
}
6472

6573
@Test
6674
void progressDetailIsEmptyWhenTotalAndCurrentAreNotNullReturnsFalse() {
67-
ProgressDetail detail = new ProgressDetail(1, 2);
75+
ProgressDetail detail = new ProgressDetail(1L, 2L);
6876
assertThat(ProgressDetail.isEmpty(detail)).isFalse();
6977
}
7078

7179
protected E createEvent() {
72-
return createEvent("status", new ProgressDetail(1, 2), "progress");
80+
return createEvent("status", new ProgressDetail(1L, 2L), "progress");
7381
}
7482

7583
protected abstract E createEvent(String status, ProgressDetail progressDetail, String progress);

0 commit comments

Comments
 (0)