Skip to content

Commit

Permalink
Fix NPE when no ConfigResolver is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean Francois Denise committed Apr 19, 2024
1 parent 997051c commit d33e58b
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions core/src/main/java/org/wildfly/glow/ScanResultsPrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private void detailed(ScanArguments arguments, ScanResults scanResults) throws E
if (!error.getPossibleAddons().isEmpty()) {
errorBuilder.append(" To correct this error, enable one of the following add-ons:\n");
for (AddOn addOn : error.getPossibleAddons()) {
String deployer = configResolver.getPossibleDeployer(addOn.getLayers());
String deployer = configResolver == null ? null : configResolver.getPossibleDeployer(addOn.getLayers());
errorBuilder.append(" - ").append(addOn.getName()).append((deployer == null ? "" : " (supported by "+deployer+" deployer)")).append("\n");
}
}
Expand Down Expand Up @@ -190,25 +190,27 @@ private void detailed(ScanArguments arguments, ScanResults scanResults) throws E
}
}

Set<String> deployers = new TreeSet<>();
for (Layer l : scanResults.getDiscoveredLayers()) {
String deployer = configResolver.getPossibleDeployer(l);
if (deployer != null) {
deployers.add(deployer);
if (configResolver != null) {
Set<String> deployers = new TreeSet<>();
for (Layer l : scanResults.getDiscoveredLayers()) {
String deployer = configResolver.getPossibleDeployer(l);
if (deployer != null) {
deployers.add(deployer);
}
}
}
for (Layer l : scanResults.getMetadataOnlyLayers()) {
String deployer = configResolver.getPossibleDeployer(l);
if (deployer != null) {
deployers.add(deployer);
for (Layer l : scanResults.getMetadataOnlyLayers()) {
String deployer = configResolver.getPossibleDeployer(l);
if (deployer != null) {
deployers.add(deployer);
}
}
}
if (!deployers.isEmpty()) {
writer.info("deployers that would get automatically enabled when deploying to openshift");
for (String deployer : deployers) {
writer.info("- " + deployer);
if (!deployers.isEmpty()) {
writer.info("deployers that would get automatically enabled when deploying to openshift");
for (String deployer : deployers) {
writer.info("- " + deployer);
}
writer.info("");
}
writer.info("");
}

if (!scanResults.getSuggestions().getStronglySuggestedConfigurations().isEmpty()) {
Expand Down

0 comments on commit d33e58b

Please sign in to comment.