mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 10:04:21 +00:00
Log and continue instead of throwing exception when caller stack is empty.
This commit is contained in:
@@ -320,12 +320,19 @@ public class Context implements AutoCloseable {
|
|||||||
StackTraceElement[] stackTrace = currThread.getStackTrace();
|
StackTraceElement[] stackTrace = currThread.getStackTrace();
|
||||||
String caller = stackTrace[stackTrace.length - 1].getClassName();
|
String caller = stackTrace[stackTrace.length - 1].getClassName();
|
||||||
|
|
||||||
String previousCaller = (String) authStateClassCallHistory.pop();
|
String previousCaller;
|
||||||
|
try {
|
||||||
|
previousCaller = (String) authStateClassCallHistory.pop();
|
||||||
|
} catch (NoSuchElementException ex) {
|
||||||
|
previousCaller = "none";
|
||||||
|
log.warn(LogManager.getHeader(this, "restore_auth_sys_state",
|
||||||
|
"no previous caller info available: {}"),
|
||||||
|
ex::getLocalizedMessage);
|
||||||
|
}
|
||||||
|
|
||||||
// if previousCaller is not the current caller *only* log a warning
|
// if previousCaller is not the current caller *only* log a warning
|
||||||
if (!previousCaller.equals(caller)) {
|
if (!previousCaller.equals(caller)) {
|
||||||
log.warn(LogManager
|
log.warn(LogManager.getHeader(
|
||||||
.getHeader(
|
|
||||||
this,
|
this,
|
||||||
"restore_auth_sys_state",
|
"restore_auth_sys_state",
|
||||||
"Class: "
|
"Class: "
|
||||||
|
Reference in New Issue
Block a user