[email protected] wrote:
> Author: erwan
> Date: Wed Jan 13 11:26:13 2010
> New Revision: 898721
>
> URL: http://svn.apache.org/viewvc?rev=898721&view=rev
> Log:
> fix test to avoid NPE
>
> Modified:
>
> ofbiz/trunk/framework/common/src/org/ofbiz/common/preferences/PreferenceServices.java
>
> Modified:
> ofbiz/trunk/framework/common/src/org/ofbiz/common/preferences/PreferenceServices.java
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/preferences/PreferenceServices.java?rev=898721&r1=898720&r2=898721&view=diff
> ==============================================================================
> ---
> ofbiz/trunk/framework/common/src/org/ofbiz/common/preferences/PreferenceServices.java
> (original)
> +++
> ofbiz/trunk/framework/common/src/org/ofbiz/common/preferences/PreferenceServices.java
> Wed Jan 13 11:26:13 2010
> @@ -144,7 +144,7 @@
> Map generalProperties = UtilProperties.getProperties("general");
> while (it.hasNext()) {
> Map.Entry pairs = (Map.Entry) it.next();
This is bad generiics. UtilProperties.getProperties() returns
Properties, which extends Hashtable<Object, Object>. The cast below
could throw a CCE.
On that note, since generalProperties has Object for it's keys, you
don't have to cast at all.
> - if (pairs.getValue().equals("DEFAULT")) {
> + if ("DEFAULT".equals(pairs.getValue())) {
> if
> (UtilValidate.isNotEmpty(generalProperties.get(pairs.getKey()))) {
> userPrefMap.put((String) pairs.getKey(),
> generalProperties.get(pairs.getKey()));
> }
>
>