Fixes #3407: Prevent NPE when publishing event

Fixes #3407: Prevent NPE
I guess it is caused by this

'''
 @Override
    public String getUuid() {
        return principal != null ? principal.getUuid() : null;
    }
'''

It is very dangerous to return null. Why did you not return a normal uuid in case if no principal is set? As part of the fix, can you also update the javadoc of the method explaining what to expect (null or not null).