mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-990: Merge change ensuring internal errors are correctly handed and logged.
This commit is contained in:
@@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
|
|
||||||
import org.apache.guacamole.GuacamoleException;
|
import org.apache.guacamole.GuacamoleException;
|
||||||
import org.apache.guacamole.GuacamoleSecurityException;
|
import org.apache.guacamole.GuacamoleSecurityException;
|
||||||
|
import org.apache.guacamole.GuacamoleServerException;
|
||||||
import org.apache.guacamole.GuacamoleUnauthorizedException;
|
import org.apache.guacamole.GuacamoleUnauthorizedException;
|
||||||
import org.apache.guacamole.GuacamoleSession;
|
import org.apache.guacamole.GuacamoleSession;
|
||||||
import org.apache.guacamole.environment.Environment;
|
import org.apache.guacamole.environment.Environment;
|
||||||
@@ -480,6 +481,18 @@ public class AuthenticationService {
|
|||||||
getLoggableAddress(request));
|
getLoggableAddress(request));
|
||||||
|
|
||||||
// Rethrow exception
|
// Rethrow exception
|
||||||
|
e.rethrowCause();
|
||||||
|
|
||||||
|
// This line SHOULD be unreachable unless a bug causes
|
||||||
|
// rethrowCause() to not actually rethrow the underlying failure
|
||||||
|
Throwable cause = e.getCause();
|
||||||
|
if (cause != null) {
|
||||||
|
logger.warn("An underlying internal error was not correctly rethrown by rethrowCause(): {}", cause.getMessage());
|
||||||
|
logger.debug("Internal error not rethrown by rethrowCause().", cause);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
logger.warn("An underlying internal error was not correctly rethrown by rethrowCause().");
|
||||||
|
|
||||||
throw e.getCauseAsGuacamoleException();
|
throw e.getCauseAsGuacamoleException();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -146,6 +146,38 @@ public class GuacamoleAuthenticationProcessException extends GuacamoleException
|
|||||||
return guacCause;
|
return guacCause;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rethrows the original GuacamoleException wrapped within this
|
||||||
|
* GuacamoleAuthenticationProcessException. If there is no such exception,
|
||||||
|
* and the cause of this failure is an unchecked RuntimeException or Error,
|
||||||
|
* that unchecked exception/error is rethrown as-is.
|
||||||
|
*
|
||||||
|
* @throws GuacamoleException
|
||||||
|
* If the underlying cause of this exception is a checked
|
||||||
|
* GuacamoleException subclass.
|
||||||
|
*
|
||||||
|
* @throws RuntimeException
|
||||||
|
* If the underlying cause of this exception is an unchecked
|
||||||
|
* RuntimeException.
|
||||||
|
*
|
||||||
|
* @throws Error
|
||||||
|
* If the underlying cause of this exception is an unchecked Error.
|
||||||
|
*/
|
||||||
|
public void rethrowCause() throws GuacamoleException, RuntimeException, Error {
|
||||||
|
|
||||||
|
// Rethrow any unchecked exceptions/errors as-is
|
||||||
|
Throwable cause = getCause();
|
||||||
|
if (cause instanceof RuntimeException)
|
||||||
|
throw (RuntimeException) cause;
|
||||||
|
if (cause instanceof Error)
|
||||||
|
throw (Error) cause;
|
||||||
|
|
||||||
|
// Pass through all other exceptions as normal GuacamoleException
|
||||||
|
// subclassses
|
||||||
|
throw getCauseAsGuacamoleException();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GuacamoleStatus getStatus() {
|
public GuacamoleStatus getStatus() {
|
||||||
return getCauseAsGuacamoleException().getStatus();
|
return getCauseAsGuacamoleException().getStatus();
|
||||||
|
Reference in New Issue
Block a user