xwiki/xwiki-platform — comment on commit 7fe467a89c3152ed25ec23476d77a1b4a8589f9d
File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/Document.java line 2018
By Enygma2002:

Not exactly.

That is the behavior of XWikiContext.getUser(), but Document.getAuthor() behaves diferently. If no author reference is present, then "" is returned and not XWiki.XWikiGuest.

Normally, the author reference should be stored and retrieved from the DB *always*. This means that you can/should not pass null to Document.setAuthorReference(...) thinking that it will be treated as guest. If you do, Document.getAuthor() will return "" and that is not what you wanted.

This is the current implementation.