Skip to content

Commit

Permalink
8301367: Add exception handler method to the BaseLdapServer
Browse files Browse the repository at this point in the history
Backport-of: 03b23a1e1bd724019ef4fdbee3463d0646329164
  • Loading branch information
GoeLin committed Jul 26, 2023
1 parent 7d29233 commit 2940973
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/jdk/com/sun/jndi/ldap/lib/BaseLdapServer.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -173,7 +173,7 @@ private void handleConnection(Socket socket) {
if (!isRunning()) {
logger.log(INFO, "Connection Handler exit {0}", t.getMessage());
} else {
t.printStackTrace();
handleSocketException(socket, t);
}
}

Expand All @@ -189,6 +189,15 @@ private void handleConnection(Socket socket) {
*/
protected void beforeConnectionHandled(Socket socket) { /* empty */ }

/*
* Called to handle exceptions observed on an established client connection.
*
* By default, an exception stack trace is printed.
*/
protected void handleSocketException(Socket socket, Throwable exception) {
exception.printStackTrace();
}

/*
* Called after an LDAP request has been read in `handleConnection()`.
*
Expand Down

1 comment on commit 2940973

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.