You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by nn...@apache.org on 2019/04/16 15:54:36 UTC
[geode] branch develop updated: GEODE-4958: Lowering the log level
to warn.
This is an automated email from the ASF dual-hosted git repository.
nnag pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new 0860e38 GEODE-4958: Lowering the log level to warn.
0860e38 is described below
commit 0860e385267ed1b01b093290a2a0a2beaa46faf3
Author: Naburun Nag <na...@cs.wisc.edu>
AuthorDate: Mon Apr 8 12:02:57 2019 -0700
GEODE-4958: Lowering the log level to warn.
* AuthenticationRequiredException is now caught and logged instead of an uncaught exception
* Lowering the log level to warn from error when this exception occurs.
---
.../internal/cache/tier/sockets/ServerConnection.java | 5 ++++-
.../cache/tier/sockets/ServerConnectionTest.java | 18 ++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnection.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnection.java
index b489dbb..d6aa8af 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnection.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnection.java
@@ -848,7 +848,8 @@ public abstract class ServerConnection implements Runnable {
} else if (uniqueId == 0) {
logger.debug("No unique ID yet. {}, {}", messageType, this.getName());
} else {
- logger.error("Failed to bind the subject of uniqueId {} for message {} with {}",
+ logger.warn(
+ "Failed to bind the subject of uniqueId {} for message {} with {} : Possible re-authentication required",
uniqueId, messageType, this.getName());
throw new AuthenticationRequiredException("Failed to find the authenticated user.");
}
@@ -1211,6 +1212,8 @@ public abstract class ServerConnection implements Runnable {
} catch (IOException ex) {
logger.warn(ex.toString() + " : Unexpected Exception");
setClientDisconnectedException(ex);
+ } catch (AuthenticationRequiredException ex) {
+ logger.warn(ex.toString() + " : Unexpected Exception");
} finally {
getAcceptor().releaseTLCommBuffer();
// DistributedSystem.releaseThreadsSockets();
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionTest.java
index ed48209..9edaeae 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionTest.java
@@ -19,8 +19,10 @@ package org.apache.geode.internal.cache.tier.sockets;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -82,6 +84,22 @@ public class ServerConnectionTest {
MockitoAnnotations.initMocks(this);
}
+ @Test
+ public void whenAuthenticationRequiredExceptionIsThrownItShouldBeCaught() {
+ AcceptorImpl acceptor = serverConnection.getAcceptor();
+ when(acceptor.isSelector()).thenReturn(true);
+ doThrow(new AuthenticationRequiredException("Test")).when(serverConnection.stats)
+ .decThreadQueueSize();
+ serverConnection.setProcessMessages(true);
+ try {
+ serverConnection.run();
+ } catch (AuthenticationRequiredException ex) {
+ fail();
+ } catch (NullPointerException ex) {
+ // Acceptable - avoiding mocking of the entire handleTermination.
+ }
+ }
+
@Test
public void pre65SecureShouldReturnUserAuthId() {