Skip to content

Commit

Permalink
[addon] fix #2204 (#3905)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Fiddian-Green <[email protected]>
  • Loading branch information
andrewfg authored Dec 9, 2023
1 parent 62a50a4 commit bb30eab
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
*/
@NonNullByDefault
public class AddonInfo implements Identifiable<String> {

public static final String NA = "n/a";

private static final Set<String> SUPPORTED_ADDON_TYPES = Set.of("automation", "binding", "misc", "persistence",
"transformation", "ui", "voice");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,15 @@ public void removeAddonInfoProvider(AddonInfoProvider addonInfoProvider) {
return a;
}
AddonInfo.Builder builder = AddonInfo.builder(a);
if (a.getDescription().isEmpty()) {
if (AddonInfo.NA.equals(a.getName())) {
builder.withName(b.getName());
} else if (AddonInfo.NA.equals(b.getName())) {
builder.withName(a.getName());
}
if (AddonInfo.NA.equals(a.getDescription())) {
builder.withDescription(b.getDescription());
} else if (AddonInfo.NA.equals(b.getDescription())) {
builder.withDescription(a.getDescription());
}
if (a.getConnection() == null && b.getConnection() != null) {
builder.withConnection(b.getConnection());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ private void initialize() {
try {
String xml = Files.readString(f.toPath());
if (xml != null && !xml.isBlank()) {
addonInfos.addAll(reader.readFromXML(xml).getAddons().stream().collect(Collectors.toSet()));
addonInfos.addAll(reader.readFromXML(xml).getAddons().stream()
.map(a -> AddonInfo.builder(a).withName(AddonInfo.NA).withDescription(AddonInfo.NA).build())
.collect(Collectors.toSet()));
} else {
logger.warn("File '{}' contents are null or empty", f.getName());
}
Expand Down

0 comments on commit bb30eab

Please sign in to comment.