harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Hindess" <mark.hind...@googlemail.com>
Subject Re: [jira] Created: (HARMONY-315) javax.crypto.Cipher.getInstance doesn't match RI exception behaviour.
Date Mon, 10 Apr 2006 06:41:10 GMT
On 4/10/06, Stepan Mishura <stepan.mishura@gmail.com> wrote:
> Hi Mark,
>
> Basing on the bug description I assume that RI checks provider parameter
> first.

Yes.

> In all your examples this parameter is invalid.

Yes.  (It was one of the test cases generated by my Perl script - that
I've nearly finished tidying up for contribution.)

> The spec. for method javax.crypto.Cipher.getInstance(String transformation,
> String provider)
> says:
> "Throws:
>     NoSuchAlgorithmException - if transformation is null, empty, in an
> invalid format, or not available from the specified provider.
>     NoSuchProviderException - if the specified provider has not been
> configured.
>     NoSuchPaddingException - if transformation contains a padding scheme
> that is not available.
>     IllegalArgumentException - if the provider is null."
>
> So IllegalArgumentException can be thrown only if the provider parameter is
> null. But IMHO in case of empty string NoSuchProviderException should be
> thrown.
>
> What do you think?

So we agree about fixing the two cases where provider is (String)null.
 We just need to decide what to do about the other two where provider
is (String)"" ?

I think we should match the RI behaviour.  That means that even in the
two cases where provider is the empty string we should still throw an
IllegalArgumentException.

I think the wording of the spec for the getInstance method that takes
a String provider is just vague because it was copied from the method
that takes a Provider object.  I think the RI behaviour reflects the
intention of the spec even if the spec is unclear.

Regards,
 Mark.

> Thanks,
> Stepan
>
> >From: Mark Hindess (JIRA)
> >Sent: Friday, April 07, 2006 1:31 AM
> >To: harmony-commits@incubator.apache.org
> >Subject: [jira] Created: (HARMONY-315) javax.crypto.Cipher.getInstance
> >doesn't match RI exception behaviour.
> >
> >javax.crypto.Cipher.getInstance doesn't match RI exception behaviour.
> >---------------------------------------------------------------------
> >
> >         Key: HARMONY-315
> >         URL: http://issues.apache.org/jira/browse/HARMONY-315
> >     Project: Harmony
> >        Type: Bug
> >
> >  Components: Classlib
> >    Reporter: Mark Hindess
> >    Priority: Trivial
> >
> >
> >javax.crypto.getInstance methods doesn't match reference behaviour.  It
> >throws NoSuchProvideExceptions when it should be throwing
> >IllegalArgumentExceptions.  See log below for details.
> >
> >RI is Sun Microsystems Inc. 1.5.0_06
> >Test is harmony classlib
> >
> >javax.crypto.Cipher.getInstance("",""):
> >  RI throws java.lang.IllegalArgumentException: Missing provider
> >  Test throws java.security.NoSuchProviderException: Provider  is not
> >available
> >
> >javax.crypto.Cipher.getInstance("",(java.lang.String)null):
> >  RI throws java.lang.IllegalArgumentException: Missing provider
> >  Test throws java.security.NoSuchProviderException: Provider null is not
> >available
> >
> >javax.crypto.Cipher.getInstance((java.lang.String)null,""):
> >  RI throws java.lang.IllegalArgumentException: Missing provider
> >  Test throws java.security.NoSuchProviderException: Provider  is not
> >available
> >
> >javax.crypto.Cipher.getInstance((java.lang.String)null,(java.lang.String)nu
> >ll):
> >  RI throws java.lang.IllegalArgumentException: Missing provider
> >  Test throws java.security.NoSuchProviderException: Provider null is not
> >available
> >
> >
> >--
> >This message is automatically generated by JIRA.
> >-
> >If you think it was sent incorrectly contact one of the administrators:
> >   http://issues.apache.org/jira/secure/Administrators.jspa
> >-
> >For more information on JIRA, see:
> >   http://www.atlassian.com/software/jira
>
>
> --
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
> Thanks,
> Stepan Mishura
> Intel Middleware Products Division
>
>


--
Mark Hindess <mark.hindess@googlemail.com>
IBM Java Technology Centre, UK.

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message