Skip to content

Commit ab05b73

Browse files
authored
Optimize the issue of default version for BuildVersion Constructor . (#2060)
1 parent 05e7b30 commit ab05b73

File tree

1 file changed

+8
-3
lines changed
  • spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/domain/values

1 file changed

+8
-3
lines changed

spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/domain/values/BuildVersion.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,21 @@
2222

2323
import javax.annotation.Nullable;
2424

25-
import org.springframework.util.Assert;
25+
import org.springframework.util.StringUtils;
2626

2727
@lombok.Data
2828
public final class BuildVersion implements Serializable, Comparable<BuildVersion> {
2929

30+
private static final String DEFAULT_VERSION = "UNKNOWN";
31+
3032
private final String value;
3133

3234
private BuildVersion(String value) {
33-
Assert.hasText(value, "'value' must not be empty");
34-
this.value = value;
35+
if(!StringUtils.hasText(value)) {
36+
this.value = DEFAULT_VERSION;
37+
} else {
38+
this.value = value;
39+
}
3540
}
3641

3742
public static BuildVersion valueOf(String s) {

0 commit comments

Comments
 (0)