Skip to content

Commit

Permalink
BLADE-743 liferay-blade-cli: ReleaseUtil: initialize releases if none…
Browse files Browse the repository at this point in the history
… are found
  • Loading branch information
drewbrokke committed Apr 5, 2024
1 parent b8c3f21 commit 386284c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cli/src/main/java/com/liferay/blade/cli/util/ReleaseUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
public class ReleaseUtil {

public static ReleaseEntry getReleaseEntry(String releaseKey) {
if (_releaseUtil == null) {
populateReleases(_DEFAULT_MAX_AGE);
}

return _releaseUtil._releaseEntryMap.getOrDefault(releaseKey, _EMPTY_RELEASE_ENTRY);
}

Expand All @@ -31,6 +35,10 @@ public static void populateReleases(int maxAge) {
}

public static Stream<ReleaseEntry> releaseEntriesStream() {
if (_releaseUtil == null) {
populateReleases(_DEFAULT_MAX_AGE);
}

return _releaseUtil._releaseEntries.stream();
}

Expand Down Expand Up @@ -118,6 +126,8 @@ private ReleaseUtil(int maxAge) {
}
}

private static final int _DEFAULT_MAX_AGE = 7;

private static final ReleaseEntry _EMPTY_RELEASE_ENTRY = new ReleaseEntry();

private static ReleaseUtil _releaseUtil;
Expand Down

0 comments on commit 386284c

Please sign in to comment.