Skip to content

Commit

Permalink
Merge pull request #32 from jfdenise/main
Browse files Browse the repository at this point in the history
Fix default datasource error handling
  • Loading branch information
jfdenise authored Dec 1, 2023
2 parents 4a35477 + 3f6e07b commit 992b682
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ public Map<Layer, Set<Env>> refreshErrors(Set<Layer> allBaseLayers) throws Excep
if (content != null) {
content = content.replaceAll("##ITEM##", uds.unboundDatasource);
}
if(fix.isEnv()) {
if (fix.isEnv()) {
Set<Env> envs = ret.get(l);
if(envs == null) {
if (envs == null) {
envs = new HashSet<>();
ret.put(l, envs);
}
Expand All @@ -168,26 +168,25 @@ public Map<Layer, Set<Env>> refreshErrors(Set<Layer> allBaseLayers) throws Excep
it.remove();
}
}
} else {
Set<IdentifiedError> noDefaultDataspourceErrors = errors.get(NO_DEFAULT_DATASOURCE_ERROR);
if (noDefaultDataspourceErrors != null) {
for (IdentifiedError error : noDefaultDataspourceErrors) {
for (Layer l : allBaseLayers) {
if (l.getAddOn() != null) {
Fix fix = l.getAddOn().getFixes().get(error.getId());
if (fix != null) {
String content = fix.getContent();
if (fix.isEnv()) {
Set<Env> envs = ret.get(l);
if (envs == null) {
envs = new HashSet<>();
ret.put(l, envs);
}
envs.add(new Env(fix.getEnvName(), Fix.getEnvValue(content), false, true));
}
Set<IdentifiedError> noDefaultDataspourceErrors = errors.get(NO_DEFAULT_DATASOURCE_ERROR);
if (noDefaultDataspourceErrors != null) {
for (IdentifiedError error : noDefaultDataspourceErrors) {
for (Layer l : allBaseLayers) {
if (l.getAddOn() != null) {
Fix fix = l.getAddOn().getFixes().get(error.getId());
if (fix != null) {
String content = fix.getContent();
if (fix.isEnv()) {
Set<Env> envs = ret.get(l);
if (envs == null) {
envs = new HashSet<>();
ret.put(l, envs);
}
String errorMessage = getAddOnFix(l.getAddOn(), content);
error.setFixed(errorMessage);
envs.add(new Env(fix.getEnvName(), Fix.getEnvValue(content), false, true));
}
String errorMessage = getAddOnFix(l.getAddOn(), content);
error.setFixed(errorMessage);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/wildfly/glow/error/Fix.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public String getDescription() {
}

public boolean isEnv() {
return description.endsWith(" env");
return description != null && description.endsWith(" env");
}

public String getEnvName() {
Expand Down

0 comments on commit 992b682

Please sign in to comment.