On Sun, Jul 27, 2008 at 3:55 PM,  <nextgens at freenetproject.org> wrote:
> Author: nextgens
> Date: 2008-07-27 07:55:59 +0000 (Sun, 27 Jul 2008)
> New Revision: 21433
>
> Modified:
>   trunk/freenet/src/freenet/l10n/L10n.java
> Log:
> l10n: prevent a potential npe (in case we remove a key from the l10n file 
> from one version to another)

String.equals(null) is false, it never give NPE.

see 
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#equals(java.lang.Object)
 # For any non-null reference value x, x.equals(null) should return false.

>
> Modified: trunk/freenet/src/freenet/l10n/L10n.java
> ===================================================================
> --- trunk/freenet/src/freenet/l10n/L10n.java    2008-07-26 23:53:01 UTC (rev 
> 21432)
> +++ trunk/freenet/src/freenet/l10n/L10n.java    2008-07-27 07:55:59 UTC (rev 
> 21433)
> @@ -116,7 +116,8 @@
>
>                        // If there is no need to keep it in the override, 
> remove it...
>                        // unless the original/default is the same as the 
> translation
> -                       if (("".equals(value)) || 
> (value.equals(currentTranslation.get(key)))) {
> +                       String currentValue = currentTranslation.get(key);
> +                       if (("".equals(value)) || ((currentValue != null) && 
> (value.equals(currentValue)))) {
>                                translationOverride.removeValue(key);
>                        } else {
>                                value = value.replaceAll("(\r|\n|\t)+", "");
>
> _______________________________________________
> cvs mailing list
> cvs at freenetproject.org
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
>

Reply via email to