Fix NPE if user is null
Commit a35f8a20ab replaced the pattern
user instanceof IdentifiedUser
with
user.isIdentifiedUser()
.
This results in a NullPointerException in case the user is null
('user instanceof IdentifiedUser' was returning false in this case).
Add a check that the user is not null in all places where the user can
be null.
Change-Id: I71f5933d9a4eb2de6cd7acf616c347bf8a5bd9f2
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -111,7 +111,7 @@ class HttpLog extends AbstractLifeCycle implements RequestLog {
|
||||
uri = uri + "?" + qs;
|
||||
}
|
||||
|
||||
if (user.isIdentifiedUser()) {
|
||||
if (user != null && user.isIdentifiedUser()) {
|
||||
IdentifiedUser who = (IdentifiedUser) user;
|
||||
if (who.getUserName() != null && !who.getUserName().isEmpty()) {
|
||||
event.setProperty(P_USER, who.getUserName());
|
||||
|
||||
Reference in New Issue
Block a user