Skip to content
Snippets Groups Projects
Commit 687bfdce authored by gnaegi's avatar gnaegi
Browse files

OO-2085 fix class cast exception in case of transient user object

parent badc059c
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,7 @@ import java.util.Date;
import java.util.Locale;
import java.util.Map;
import org.olat.admin.user.imp.TransientIdentity;
import org.olat.core.gui.components.form.ValidationError;
import org.olat.core.gui.components.form.flexible.FormItem;
import org.olat.core.gui.components.form.flexible.FormItemContainer;
......@@ -73,9 +74,14 @@ public class DateDisplayPropertyHandler extends AbstractUserPropertyHandler {
if (DATE_TYPE_CR.equals(myName))
return user.getCreationDate();
if (DATE_TYPE_LL.equals(myName)) {
Identity id = ((UserImpl)user).getIdentity();
if (id != null) {
return id.getLastLogin();
if (user instanceof UserImpl) {
Identity id = ((UserImpl)user).getIdentity();
if (id != null) {
return id.getLastLogin();
}
} else if (user instanceof TransientIdentity) {
// anticipated, some kind of preview screen
return new Date(0);
}
// huh, we didn't find this identity
log.warn("Couldn't find Identity for given User: " + user.getKey());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment