|
From: Andreas K. (JIRA) <no...@sp...> - 2008-11-27 15:35:19
|
[ http://jira.springframework.org/browse/RCP-222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=41388#action_41388 ]
Andreas Kuhtz commented on RCP-222:
-----------------------------------
The TransientPreferences has a problem. The getSpi() should return null if the value is not available in the preferences. This allows to specify a default value that will be used.
{code:title=TransientPreferences.java}
protected String getSpi(String key) {
if (values.containsKey(key)) {
return (String) values.get(key);
}
//return ""; --> return null here to get the default value!!!!!
return null;
}
{code}
The get() of AbstractReferences returns the default value if getSpi() returns null.
{code:title=AbstractPreferences.java}
public String get(String key, String def) {
if (key==null)
throw new NullPointerException("Null key");
synchronized(lock) {
if (removed)
throw new IllegalStateException("Node has been removed.");
String result = null;
try {
result = getSpi(key);
} catch (Exception e) {
// Ignoring exception causes default to be returned
}
return (result==null ? def : result);
}
}
{code}
> Promote Settings Support from sandbox to src
> --------------------------------------------
>
> Key: RCP-222
> URL: http://jira.springframework.org/browse/RCP-222
> Project: Spring Rich Client Project
> Issue Type: New Feature
> Components: Core
> Reporter: Peter De Bruycker
> Assignee: Peter De Bruycker
> Fix For: 1.1.0
>
>
> Promote settings and prefs support to src
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.springframework.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|