Skip to content

Commit

Permalink
#3499 MCP reports are not shown if the initial MCP job failed
Browse files Browse the repository at this point in the history
  • Loading branch information
YegorKozlov committed Jan 8, 2025
1 parent 5f45a0c commit b8ea02e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com)
### Fixed

- #3471 - EmailService not working due to unsatisfied reference to MailTemplateManager in AEM on prem
- #3499 - MCP reports are not shown if the initial MCP job failed

## 6.9.10 - 2024-12-13

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,10 @@ public Collection<ProcessInstance> getInactiveProcesses() {
TreeFilteringResourceVisitor visitor = new TreeFilteringResourceVisitor();
visitor.setLeafVisitor((r, l) -> {
if (!activeProcesses.containsKey(r.getName())) {
processes.add(r.adaptTo(ArchivedProcessInstance.class));
ArchivedProcessInstance inst = r.adaptTo(ArchivedProcessInstance.class);
if (inst != null) {
processes.add(inst);
}
}
});
visitor.accept(tree);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -243,8 +244,14 @@ public void recordErrors(int step, List<Failure> failures, ResourceResolver rr)
List<ArchivedProcessFailure> archivedFailures = failures.stream().map(ArchivedProcessFailure::adapt).collect(Collectors.toList());
infoBean.setReportedErrors(archivedFailures);
try {
ResourceUtil.getOrCreateResource(rr, BASE_PATH,
Collections.singletonMap(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_FOLDER), null, false);
ResourceUtil.getOrCreateResource(rr, getPath(),
Collections.singletonMap(JcrConstants.JCR_PRIMARYTYPE, "cq:Page"), null, false);

String errFolder = getPath() + "/jcr:content/failures/step" + (step + 1);
JcrUtil.createPath(errFolder, "nt:unstructured", rr.adaptTo(Session.class));
ResourceUtil.getOrCreateResource(rr, errFolder,
Collections.singletonMap(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED), "nt:unstructured", false);
if (rr.hasChanges()) {
rr.commit();
}
Expand All @@ -261,7 +268,7 @@ public void recordErrors(int step, List<Failure> failures, ResourceResolver rr)
});
}
batch.commitBatch();
} catch (RepositoryException | PersistenceException | LoginException | NullPointerException ex) {
} catch (PersistenceException | LoginException | NullPointerException ex) {
LOG.error("Unable to record errors", ex);
}
}
Expand Down

0 comments on commit b8ea02e

Please sign in to comment.