You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Mikhail Loenko <ml...@gmail.com> on 2006/03/13 09:13:24 UTC

[classlib] bug-to-bug compatibility: SecureRandom

Hello,

one more issue for discussion/approval.

class: java.security.SecureRandom
method: public static SecureRandom getInstance(String algorithm)

According to spec, it throws:
NoSuchAlgorithmException - if the RNG algorithm is not available in
the caller's environment.

RI throws NullPointerException if algorithm==null (seems like they don't do
any check)

Harmony currently makes explicit check:
        if (algorithm == null) {
            throw new NullPointerException("Algorithm is null");
        }

Thoughts?

Thanks,
Mikhail Loenko
Intel Middleware Products Division

Re: [classlib] bug-to-bug compatibility: SecureRandom

Posted by Anton Avtamonov <an...@gmail.com>.
On 3/13/06, Paulex Yang <pa...@gmail.com> wrote:
> Mikhail
>
> I think current Harmony code is fine in this case. Because it is
> reasonable to consider null as another exceptional case and to
> differentiate it with the case of non-existing algorithm.

+1

--
Anton Avtamonov,
Intel Middleware Products Division

Re: [classlib] bug-to-bug compatibility: SecureRandom

Posted by Paulex Yang <pa...@gmail.com>.
Mikhail

I think current Harmony code is fine in this case. Because it is 
reasonable to consider null as another exceptional case and to 
differentiate it with the case of non-existing algorithm.

Mikhail Loenko wrote:
> Hello,
>
> one more issue for discussion/approval.
>
> class: java.security.SecureRandom
> method: public static SecureRandom getInstance(String algorithm)
>
> According to spec, it throws:
> NoSuchAlgorithmException - if the RNG algorithm is not available in
> the caller's environment.
>
> RI throws NullPointerException if algorithm==null (seems like they don't do
> any check)
>
> Harmony currently makes explicit check:
>         if (algorithm == null) {
>             throw new NullPointerException("Algorithm is null");
>         }
>
> Thoughts?
>
> Thanks,
> Mikhail Loenko
> Intel Middleware Products Division
>
>   


-- 
Paulex Yang
China Software Development Lab
IBM