You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Vladimir Ivanov <iv...@gmail.com> on 2006/08/08 11:12:20 UTC
[classlib][io] compatibility: need an advise
I need a consultation: should we follow RI or spec in the case of issue
1100?
Thanks, Vladimir
On 8/8/06, Vladimir Ivanov (JIRA) <ji...@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
>
>
>
Re: [classlib][io] compatibility: need an advise
Posted by Andrew Zhang <zh...@gmail.com>.
I suggest follow RI for this case. Because spec says nothing about NPE in
DataOutputStream(OutputStream) constructor, and following spec may cause
legacy applications broken. Furthermore, RI's behaviour is acceptable this
time. :)
On 8/8/06, Vladimir Ivanov <iv...@gmail.com> wrote:
>
> I need a consultation: should we follow RI or spec in the case of issue
> 1100?
>
> Thanks, Vladimir
>
>
> On 8/8/06, Vladimir Ivanov (JIRA) <ji...@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
> >
> >
> >
>
>
--
Andrew Zhang
China Software Development Lab, IBM
Re: [classlib][io] compatibility: need an advise
Posted by Mikhail Fursov <mi...@gmail.com>.
+1 to follow RI
Here are links to similar bugs:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4010323
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4012133
AFAIU this is not a RI bug but a feature today.
On 8/8/06, Vladimir Ivanov <iv...@gmail.com> wrote:
>
> On 8/8/06, Richard Liang <ri...@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) <ji...@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
> >
> >
>
>
--
Mikhail Fursov
Re: [classlib][io] compatibility: need an advise
Posted by Vladimir Ivanov <iv...@gmail.com>.
On 8/8/06, Richard Liang <ri...@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) <ji...@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
>
>
Re: [classlib][io] compatibility: need an advise
Posted by Richard Liang <ri...@gmail.com>.
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.
Thanks a lot.
Best regards,
Richard
> Thanks, Vladimir
>
>
> On 8/8/06, Vladimir Ivanov (JIRA) <ji...@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