harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stepan Mishura" <stepan.mish...@gmail.com>
Subject [classlib][security] Non-bug difference with RI for PKIXParameters.setDate(null)? (was: Re: [jira] Commented: (HARMONY-2882) ...)
Date Tue, 09 Jan 2007 11:39:21 GMT
Hi,

I'm going to close HARMONY-2882 as "non-bug difference with RI". From my
point of view RI's behaviour violates the spec. and looks inconsistent.
If there are other opinions about the issue please speak up.

Summary: it is not possible to reset 'date' parameter to the current time
(by invoking setDate(null)) on RI
(IOW, if 'date' parameter was set non-null value then it is not possible to
set it back to null value by setDate(null).)

Accoring to the spec.:
*) for java.security.cert.PKIXParameters class it says:
" ... Any parameter that is not set (or is set to null) will be set to the
default value for that parameter. The default value for the date parameter
is null, which indicates the current time when the path is validated..."

*) for PKIXParameters.setDate(Date date) it states:
" Parameters:
date - the Date, or null for the current time"

So null is a valid value for the 'date' parameter for the method. But
testing showed that RI accepts any value for date but null. It just ignores
it.

The following test demonstrates the difference:

        PKIXParameters p = new PKIXParameters(taSet);
        p.setDate(new Date(555L)); // assing non-null value
        assertEquals(555L, p.getDate().getTime());

        p.setDate(null); // set to the current time
        assertEquals(555L, p.getDate().getTime()); // <== RI pass and
Harmony fail here

Thanks,
Stepan.


On 12/28/06, Leo Li (JIRA) wrote:
>
>    [
> http://issues.apache.org/jira/browse/HARMONY-2882?page=comments#action_12461132]
>
> Leo Li commented on HARMONY-2882:
> ---------------------------------
>
> Hi, Stepan:
>      I think it is OK to mark it as non-bug difference since currently we
> have no indications that application will depend on this behavior.(Actually
> I agree with you that the currenttime should be set, but RI ...)
>
> Thanks,
> Leo.
>
> > [classlib][security]PKIXParameters.setDate(null) has no effect on the
> original date value on RI but Harmony sets it to null.
> >
> ----------------------------------------------------------------------------------------------------------------------------
> >
> >                 Key: HARMONY-2882
> >                 URL: http://issues.apache.org/jira/browse/HARMONY-2882
> >             Project: Harmony
> >          Issue Type: Bug
> >          Components: Classlib
> >            Reporter: Leo Li
> >         Assigned To: Stepan Mishura
> >         Attachments: patch-2882.diff
> >
> >
> > Here is a testcase:
> > public void testSetDate()
> > {
> >    Set taSet = TestUtils.getTrustAnchorSet();
> >    PKIXParameters p = new PKIXParameters(taSet);
> >    Date toBeSet = new Date(555L);
> >    p.setDate(toBeSet);
> >   p.setDate(null);
> >   assertEquals(555L, p.getDate().getTime());
> > }
> > RI passes.
> > Harmony fails.
>
> --
> 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
>
>
>


-- 
Stepan Mishura
Intel Enterprise Solutions Software Division

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message