Add Nullable Annotations

Added Nullable to methods that may return a null value

Closes gh-18046
This commit is contained in:
Josh Cummings 2025-11-04 15:08:12 -07:00
parent 63f28a7e1f
commit 5662e17370
2 changed files with 4 additions and 4 deletions

View File

@ -58,7 +58,7 @@ public class RequestAttributeAuthenticationFilter extends AbstractPreAuthenticat
* missing and {@code exceptionIfVariableMissing} is set to {@code true}. * missing and {@code exceptionIfVariableMissing} is set to {@code true}.
*/ */
@Override @Override
protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) { protected @Nullable Object getPreAuthenticatedPrincipal(HttpServletRequest request) {
String principal = (String) request.getAttribute(this.principalEnvironmentVariable); String principal = (String) request.getAttribute(this.principalEnvironmentVariable);
if (principal == null && this.exceptionIfVariableMissing) { if (principal == null && this.exceptionIfVariableMissing) {
throw new PreAuthenticatedCredentialsNotFoundException( throw new PreAuthenticatedCredentialsNotFoundException(
@ -73,7 +73,7 @@ public class RequestAttributeAuthenticationFilter extends AbstractPreAuthenticat
* credentials value. Otherwise a dummy value will be used. * credentials value. Otherwise a dummy value will be used.
*/ */
@Override @Override
protected Object getPreAuthenticatedCredentials(HttpServletRequest request) { protected @Nullable Object getPreAuthenticatedCredentials(HttpServletRequest request) {
if (this.credentialsEnvironmentVariable != null) { if (this.credentialsEnvironmentVariable != null) {
return request.getAttribute(this.credentialsEnvironmentVariable); return request.getAttribute(this.credentialsEnvironmentVariable);
} }

View File

@ -59,7 +59,7 @@ public class RequestHeaderAuthenticationFilter extends AbstractPreAuthenticatedP
* {@code exceptionIfHeaderMissing} is set to {@code true}. * {@code exceptionIfHeaderMissing} is set to {@code true}.
*/ */
@Override @Override
protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) { protected @Nullable Object getPreAuthenticatedPrincipal(HttpServletRequest request) {
String principal = request.getHeader(this.principalRequestHeader); String principal = request.getHeader(this.principalRequestHeader);
if (principal == null && this.exceptionIfHeaderMissing) { if (principal == null && this.exceptionIfHeaderMissing) {
throw new PreAuthenticatedCredentialsNotFoundException( throw new PreAuthenticatedCredentialsNotFoundException(
@ -74,7 +74,7 @@ public class RequestHeaderAuthenticationFilter extends AbstractPreAuthenticatedP
* will be used. * will be used.
*/ */
@Override @Override
protected Object getPreAuthenticatedCredentials(HttpServletRequest request) { protected @Nullable Object getPreAuthenticatedCredentials(HttpServletRequest request) {
if (this.credentialsRequestHeader != null) { if (this.credentialsRequestHeader != null) {
return request.getHeader(this.credentialsRequestHeader); return request.getHeader(this.credentialsRequestHeader);
} }