Skip to content
Snippets Groups Projects
Commit 3cefa2f1 authored by srosse's avatar srosse
Browse files

OO-1468: only log error if the property to set is unknown ( or disabled )

parent b8149944
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,8 @@ import org.olat.core.commons.persistence.PersistentObject; ...@@ -33,6 +33,8 @@ import org.olat.core.commons.persistence.PersistentObject;
import org.olat.core.id.Preferences; import org.olat.core.id.Preferences;
import org.olat.core.id.User; import org.olat.core.id.User;
import org.olat.core.id.UserConstants; import org.olat.core.id.UserConstants;
import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing;
import org.olat.user.propertyhandlers.UserPropertyHandler; import org.olat.user.propertyhandlers.UserPropertyHandler;
/** /**
...@@ -55,6 +57,7 @@ import org.olat.user.propertyhandlers.UserPropertyHandler; ...@@ -55,6 +57,7 @@ import org.olat.user.propertyhandlers.UserPropertyHandler;
public class UserImpl extends PersistentObject implements User { public class UserImpl extends PersistentObject implements User {
private static final long serialVersionUID = -2872102058369727753L; private static final long serialVersionUID = -2872102058369727753L;
private static final OLog log = Tracing.createLoggerFor(UserImpl.class);
private Preferences preferences; private Preferences preferences;
...@@ -158,6 +161,7 @@ public class UserImpl extends PersistentObject implements User { ...@@ -158,6 +161,7 @@ public class UserImpl extends PersistentObject implements User {
/** /**
* @see org.olat.core.id.User#getProperty(java.lang.String, java.util.Locale) * @see org.olat.core.id.User#getProperty(java.lang.String, java.util.Locale)
*/ */
@Override
public String getProperty(String propertyName, Locale locale) { public String getProperty(String propertyName, Locale locale) {
UserManager um = UserManager.getInstance(); UserManager um = UserManager.getInstance();
UserPropertyHandler propertyHandler = um.getUserPropertiesConfig().getPropertyHandler(propertyName); UserPropertyHandler propertyHandler = um.getUserPropertiesConfig().getPropertyHandler(propertyName);
...@@ -169,10 +173,15 @@ public class UserImpl extends PersistentObject implements User { ...@@ -169,10 +173,15 @@ public class UserImpl extends PersistentObject implements User {
/** /**
* @see org.olat.core.id.User#setProperty(java.lang.String, java.lang.String) * @see org.olat.core.id.User#setProperty(java.lang.String, java.lang.String)
*/ */
@Override
public void setProperty(String propertyName, String propertyValue) { public void setProperty(String propertyName, String propertyValue) {
UserManager um = UserManager.getInstance(); UserManager um = UserManager.getInstance();
UserPropertyHandler propertyHandler = um.getUserPropertiesConfig().getPropertyHandler(propertyName); UserPropertyHandler propertyHandler = um.getUserPropertiesConfig().getPropertyHandler(propertyName);
propertyHandler.setUserProperty(this, propertyValue); if(propertyHandler == null) {
log.error("Try to set unkown property: " + propertyName + " for user: " + getKey());
} else {
propertyHandler.setUserProperty(this, propertyValue);
}
} }
/** /**
......
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