harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Ivanov" <ivavladi...@gmail.com>
Subject Re: [classlib][io] compatibility: need an advise
Date Tue, 08 Aug 2006 10:16:11 GMT
On 8/8/06, Richard Liang <richard.liangyx@gmail.com> wrote:
>
>
>
> Vladimir Ivanov wrote:
> > I need a consultation: should we follow RI or spec in the case of issue
> > 1100?
> >
> I think we shall follow RI for this this problem. Because the behavior
> of RI is reasonable though it seems that it is not compliant with Spec.
> If we decide to throw NPE, maybe some use applications would break.


OK, I'll prepare patch if nobody objects.

 Thanks, Vladimir


Thanks a lot.
>
> Best regards,
> Richard
>
> > Thanks, Vladimir
> >
> >
> > On 8/8/06, Vladimir Ivanov (JIRA) <jira@apache.org> wrote:
> >>
> >> [classlib][io] compatibility: Harmony method
> >> DataOutputStream(null).writeBytes("") throws NPE while RI does not
> >>
> >>
> ---------------------------------------------------------------------------------------------------------------
> >>
> >>
> >>                 Key: HARMONY-1100
> >>                 URL: http://issues.apache.org/jira/browse/HARMONY-1100
> >>             Project: Harmony
> >>          Issue Type: Bug
> >>          Components: Classlib
> >>            Reporter: Vladimir Ivanov
> >>
> >>
> >> The spec says for the java.io package: "Unless otherwise noted,
> >> passing a
> >> null argument to a constructor or method in any class or interface in
> >> this
> >> package will cause a NullPointerException to be thrown".
> >> and says nothing about 'null' for DataOutputStream constructor.
> >> So, according to spec the  DataOutputStream(null) should lead to the
> NPE
> >> instead of writeBytes but according to RI no NPE for constructor and
> >> zero-length string for writeBytes.
> >>
> >> =================== test.java =========================
> >> import java.io.DataOutputStream;
> >>
> >> public class test {
> >>    public static void main(String args[]) throws Exception {
> >>        System.out.println("res = " + new DataOutputStream(null));
> >>        new DataOutputStream(null).writeBytes("");
> >>        System.out.println("OK");
> >>    }
> >> }
> >> ===================================================
> >>
> >> Output:
> >> C:\tmp\tmp17>C:\jrockit-jdk1.5.0-windows-ia32\bin\java.exe -cp .
> >> -showversion test
> >> java version "1.5.0"
> >> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
> >> BEA WebLogic JRockit(R) (build dra-38972-20041208-2001-win-ia32,
> >> R25.0.0-75, GC: System optimized over throughput (initial strategy
> >> singleparpar))
> >>
> >> res = java.io.DataOutputStream@1b3494
> >> OK
> >>
> >> C:\tmp\tmp17>C:\harmony\trunk_0427\deploy\jdk\jre\bin\java.exe -cp .
> >> -showversion test
> >> java version 1.5 (subset)
> >>
> >> (c) Copyright 1991, 2006 The Apache Software Foundation or its
> >> licensors,
> >> as applicable.
> >> res = java.io.DataOutputStream@13541354
> >> Exception in thread "main" java.lang.NullPointerException
> >>        at java.io.DataOutputStream.writeBytes(DataOutputStream.java
> :163)
> >>        at test.main(test.java:6)
> >>
> >>
> >> --
> >> 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
> >>
> >>
> >>
> >
>
> --
> Richard Liang
> China Software Development Lab, IBM
>
>
>
> ---------------------------------------------------------------------
> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message