You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Elena Sayapina (JIRA)" <ji...@apache.org> on 2007/07/10 11:44:04 UTC

[jira] Created: (HARMONY-4405) [classlib][luni] Compatibility: ZipOutputStream.write(null, off, length) exception throwing order differs on Harmony and RI

[classlib][luni] Compatibility: ZipOutputStream.write(null, off, length) exception throwing order differs on Harmony and RI
---------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-4405
                 URL: https://issues.apache.org/jira/browse/HARMONY-4405
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Elena Sayapina
            Priority: Minor


ZipOutputStream.write(null, offset, length) exception throwing order differs on Harmony and RI 

This method throws NullPointerException on Harmony if byte array is null and length (or offset) is negative, but throw IndexOutOfBoundsException on RI. 

For me throwing NullPointerException is more appropriate here (taking into account that both IndexOutOfBoundsException and 
NullPointerException possible according to Java API Spec), so bug was created only to record non-bug difference between Harmony and RI.
Please, feel free to close the issue if you agree with this.

Consider the following code:

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.ZipOutputStream;

public class writeTest {

	static byte[] data = null;
	
	public static void main(String[] args) throws IOException {
		File test = new File("test.zip");
		test.createNewFile();
		FileOutputStream out = new FileOutputStream(test.getName());
		ZipOutputStream zipout = new ZipOutputStream(out);
		try {
			zipout.write(data, 0, -2);
		} catch (Exception e) {
			System.out.println(e);
		}
	}
}


Output on Harmony-r552422:

Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r552422, (Jul  2 2007), Windows/ia32/msvc 1310, release build
http://harmony.apache.org

java.lang.NullPointerException


Output on RI:

java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)

java.lang.IndexOutOfBoundsException


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (HARMONY-4405) [classlib][luni] Compatibility: ZipOutputStream.write(null, off, length) exception throwing order differs on Harmony and RI

Posted by "Tony Wu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4405?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tony Wu resolved HARMONY-4405.
------------------------------

    Resolution: Fixed

Hi Elena,

Fixed at r554950, please check if fixed as you expected. Thanks.

> [classlib][luni] Compatibility: ZipOutputStream.write(null, off, length) exception throwing order differs on Harmony and RI
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4405
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4405
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Elena Sayapina
>            Assignee: Tony Wu
>            Priority: Minor
>
> ZipOutputStream.write(null, offset, length) exception throwing order differs on Harmony and RI 
> This method throws NullPointerException on Harmony if byte array is null and length (or offset) is negative, but throw IndexOutOfBoundsException on RI. 
> For me throwing NullPointerException is more appropriate here (taking into account that both IndexOutOfBoundsException and 
> NullPointerException possible according to Java API Spec), so bug was created only to record non-bug difference between Harmony and RI.
> Please, feel free to close the issue if you agree with this.
> Consider the following code:
> import java.io.File;
> import java.io.FileOutputStream;
> import java.io.IOException;
> import java.util.zip.ZipOutputStream;
> public class writeTest {
> 	static byte[] data = null;
> 	
> 	public static void main(String[] args) throws IOException {
> 		File test = new File("test.zip");
> 		test.createNewFile();
> 		FileOutputStream out = new FileOutputStream(test.getName());
> 		ZipOutputStream zipout = new ZipOutputStream(out);
> 		try {
> 			zipout.write(data, 0, -2);
> 		} catch (Exception e) {
> 			System.out.println(e);
> 		}
> 	}
> }
> Output on Harmony-r552422:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
> as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r552422, (Jul  2 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> java.lang.NullPointerException
> Output on RI:
> java version "1.5.0_11"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)
> java.lang.IndexOutOfBoundsException

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (HARMONY-4405) [classlib][luni] Compatibility: ZipOutputStream.write(null, off, length) exception throwing order differs on Harmony and RI

Posted by "Tony Wu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4405?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tony Wu reassigned HARMONY-4405:
--------------------------------

    Assignee: Tony Wu

> [classlib][luni] Compatibility: ZipOutputStream.write(null, off, length) exception throwing order differs on Harmony and RI
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4405
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4405
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Elena Sayapina
>            Assignee: Tony Wu
>            Priority: Minor
>
> ZipOutputStream.write(null, offset, length) exception throwing order differs on Harmony and RI 
> This method throws NullPointerException on Harmony if byte array is null and length (or offset) is negative, but throw IndexOutOfBoundsException on RI. 
> For me throwing NullPointerException is more appropriate here (taking into account that both IndexOutOfBoundsException and 
> NullPointerException possible according to Java API Spec), so bug was created only to record non-bug difference between Harmony and RI.
> Please, feel free to close the issue if you agree with this.
> Consider the following code:
> import java.io.File;
> import java.io.FileOutputStream;
> import java.io.IOException;
> import java.util.zip.ZipOutputStream;
> public class writeTest {
> 	static byte[] data = null;
> 	
> 	public static void main(String[] args) throws IOException {
> 		File test = new File("test.zip");
> 		test.createNewFile();
> 		FileOutputStream out = new FileOutputStream(test.getName());
> 		ZipOutputStream zipout = new ZipOutputStream(out);
> 		try {
> 			zipout.write(data, 0, -2);
> 		} catch (Exception e) {
> 			System.out.println(e);
> 		}
> 	}
> }
> Output on Harmony-r552422:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
> as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r552422, (Jul  2 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> java.lang.NullPointerException
> Output on RI:
> java version "1.5.0_11"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)
> java.lang.IndexOutOfBoundsException

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (HARMONY-4405) [classlib][luni] Compatibility: ZipOutputStream.write(null, off, length) exception throwing order differs on Harmony and RI

Posted by "Elena Sayapina (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4405?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Elena Sayapina closed HARMONY-4405.
-----------------------------------


Thank you, Tony.
Verified on Harmony-r555176-msvc-release.

> [classlib][luni] Compatibility: ZipOutputStream.write(null, off, length) exception throwing order differs on Harmony and RI
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4405
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4405
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Elena Sayapina
>            Assignee: Tony Wu
>            Priority: Minor
>
> ZipOutputStream.write(null, offset, length) exception throwing order differs on Harmony and RI 
> This method throws NullPointerException on Harmony if byte array is null and length (or offset) is negative, but throw IndexOutOfBoundsException on RI. 
> For me throwing NullPointerException is more appropriate here (taking into account that both IndexOutOfBoundsException and 
> NullPointerException possible according to Java API Spec), so bug was created only to record non-bug difference between Harmony and RI.
> Please, feel free to close the issue if you agree with this.
> Consider the following code:
> import java.io.File;
> import java.io.FileOutputStream;
> import java.io.IOException;
> import java.util.zip.ZipOutputStream;
> public class writeTest {
> 	static byte[] data = null;
> 	
> 	public static void main(String[] args) throws IOException {
> 		File test = new File("test.zip");
> 		test.createNewFile();
> 		FileOutputStream out = new FileOutputStream(test.getName());
> 		ZipOutputStream zipout = new ZipOutputStream(out);
> 		try {
> 			zipout.write(data, 0, -2);
> 		} catch (Exception e) {
> 			System.out.println(e);
> 		}
> 	}
> }
> Output on Harmony-r552422:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
> as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r552422, (Jul  2 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> java.lang.NullPointerException
> Output on RI:
> java version "1.5.0_11"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)
> java.lang.IndexOutOfBoundsException

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.