mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-02-23 23:31:27 +00:00
SEC-896: Changed result.toString() to String.valueOf(result) in tag class to prevent NPE when value of property is null
This commit is contained in:
parent
dd5edbcce9
commit
c372c2df87
@ -33,7 +33,7 @@ import javax.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
/**
|
||||
* An {@link javax.servlet.jsp.tagext.Tag} implementation that allows convenient access to the current
|
||||
* <code>Authentication</code> object. The <tt>operation</tt> attribute
|
||||
* <code>Authentication</code> object.
|
||||
* <p>
|
||||
* Whilst JSPs can access the <code>SecurityContext</code> directly, this tag avoids handling <code>null</code> conditions.
|
||||
*
|
||||
@ -93,13 +93,13 @@ public class AuthenticationTag extends TagSupport {
|
||||
|
||||
if (auth.getPrincipal() == null) {
|
||||
return Tag.EVAL_PAGE;
|
||||
} else {
|
||||
try {
|
||||
BeanWrapperImpl wrapper = new BeanWrapperImpl(auth);
|
||||
result = wrapper.getPropertyValue(property);
|
||||
} catch (BeansException e) {
|
||||
throw new JspException(e);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
BeanWrapperImpl wrapper = new BeanWrapperImpl(auth);
|
||||
result = wrapper.getPropertyValue(property);
|
||||
} catch (BeansException e) {
|
||||
throw new JspException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ public class AuthenticationTag extends TagSupport {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
writeMessage(result.toString());
|
||||
writeMessage(String.valueOf(result));
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user