You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Vladimir Ivanov (JIRA)" <ji...@apache.org> on 2006/08/08 11:03:14 UTC

[jira] Created: (HARMONY-1100) [classlib][io] compatibility: Harmony method DataOutputStream(null).writeBytes("") throws NPE while RI does not

[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

        

[jira] Closed: (HARMONY-1100) [classlib][io] compatibility: Harmony method DataOutputStream(null).writeBytes("") throws NPE while RI does not

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ 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

        

[jira] Resolved: (HARMONY-1100) [classlib][io] compatibility: Harmony method DataOutputStream(null).writeBytes("") throws NPE while RI does not

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1100?page=all ]

Tim Ellison resolved HARMONY-1100.
----------------------------------

    Resolution: Fixed

Thanks Vladimir.

Patch applied to LUNI module at repo revision r432348.

Please check that the patch was applied as you expected.


> [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

        

[jira] Commented: (HARMONY-1100) [classlib][io] compatibility: Harmony method DataOutputStream(null).writeBytes("") throws NPE while RI does not

Posted by "Vladimir Ivanov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1100?page=comments#action_12428902 ] 
            
Vladimir Ivanov commented on HARMONY-1100:
------------------------------------------

verified, thanks

> [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

        

[jira] Assigned: (HARMONY-1100) [classlib][io] compatibility: Harmony method DataOutputStream(null).writeBytes("") throws NPE while RI does not

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1100?page=all ]

Tim Ellison reassigned HARMONY-1100:
------------------------------------

    Assignee: Tim Ellison

> [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

        

[jira] Updated: (HARMONY-1100) [classlib][io] compatibility: Harmony method DataOutputStream(null).writeBytes("") throws NPE while RI does not

Posted by "Vladimir Ivanov (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1100?page=all ]

Vladimir Ivanov updated HARMONY-1100:
-------------------------------------

    Attachment: DataOutputStream.patch

unit test + patch

> [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
>         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