harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Ellison (JIRA)" <j...@apache.org>
Subject [jira] Closed: (HARMONY-1100) [classlib][io] compatibility: Harmony method DataOutputStream(null).writeBytes("") throws NPE while RI does not
Date Fri, 18 Aug 2006 13:35:19 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-1100?page=all ]

Tim Ellison closed HARMONY-1100.
--------------------------------


Verified by Vladimir.


> [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
>         Assigned To: Tim Ellison
>         Attachments: DataOutputStream.patch
>
>
> 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

        

Mime
View raw message