This is an automated email from the ASF dual-hosted git repository.
tmaret pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-journal.git
The following commit(s) were added to refs/heads/master by this push:
new a5ce436 SLING-10312 - Include exception message when handling
exception while communicating to the journal
a5ce436 is described below
commit a5ce4363e60afd3aa9f90c92e67f4e4af2990474
Author: tmaret <[email protected]>
AuthorDate: Sat Apr 17 15:25:36 2021 +0200
SLING-10312 - Include exception message when handling exception while
communicating to the journal
---
.../sling/distribution/journal/shared/JournalAvailableChecker.java | 6 +++---
.../distribution/journal/shared/JournalAvailableCheckerTest.java | 5 +++++
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git
a/src/main/java/org/apache/sling/distribution/journal/shared/JournalAvailableChecker.java
b/src/main/java/org/apache/sling/distribution/journal/shared/JournalAvailableChecker.java
index 1a5180f..58773bd 100644
---
a/src/main/java/org/apache/sling/distribution/journal/shared/JournalAvailableChecker.java
+++
b/src/main/java/org/apache/sling/distribution/journal/shared/JournalAvailableChecker.java
@@ -128,13 +128,13 @@ public class JournalAvailableChecker implements
EventHandler {
@Override
public synchronized void handleEvent(Event event) {
String type = (String)
event.getProperty(ExceptionEventSender.KEY_TYPE);
-
+ String msg = (String)
event.getProperty(ExceptionEventSender.KEY_MESSAGE);
if (this.marker.isRegistered()) {
- LOG.warn("Received exception event {}. Journal is considered
unavailable.", type);
+ LOG.warn("Received exception event {}: {}. Journal is considered
unavailable.", type, msg);
this.marker.unRegister();
this.backoffRetry.startChecks();
} else {
- LOG.info("Received exception event {}. Journal still
unavailable.", type);
+ LOG.info("Received exception event {}: {}. Journal still
unavailable.", type, msg);
}
String errCode = (String)
event.getProperty(ExceptionEventSender.KEY_ERROR_CODE);
if ((errCode != null) && !errCode.isEmpty()) {
diff --git
a/src/test/java/org/apache/sling/distribution/journal/shared/JournalAvailableCheckerTest.java
b/src/test/java/org/apache/sling/distribution/journal/shared/JournalAvailableCheckerTest.java
index 0ed61e3..7a40eb2 100644
---
a/src/test/java/org/apache/sling/distribution/journal/shared/JournalAvailableCheckerTest.java
+++
b/src/test/java/org/apache/sling/distribution/journal/shared/JournalAvailableCheckerTest.java
@@ -131,6 +131,11 @@ public class JournalAvailableCheckerTest {
activateChecksOnEvent(new IOException("Expected"), 0);
}
+ @Test
+ public void testActivateChecksOnEventWithoutMessage() throws
InterruptedException {
+ activateChecksOnEvent(new IOException(), 0);
+ }
+
public void activateChecksOnEvent(Exception e, int expectedCounter) throws
InterruptedException {
Counter counter = new TestCounter();
when(metrics.getJournalErrorCodeCount("400")).thenReturn(counter);