You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mark Hindess (JIRA)" <ji...@apache.org> on 2007/01/12 23:20:27 UTC
[jira] Resolved: (HARMONY-2433) [classlib][awt] Different order of
exceptions on j.a.print.Book.setPage(,,)
[ https://issues.apache.org/jira/browse/HARMONY-2433?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Hindess resolved HARMONY-2433.
-----------------------------------
Resolution: Fixed
Assignee: Mark Hindess
Patches applied in r495763. Please confirm that the patches have been applied as expected. (Denis, can you please add the Apache License to files created by patches? Thanks.)
> [classlib][awt] Different order of exceptions on j.a.print.Book.setPage(,,)
> ---------------------------------------------------------------------------
>
> Key: HARMONY-2433
> URL: https://issues.apache.org/jira/browse/HARMONY-2433
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Denis Kishenko
> Assigned To: Mark Hindess
> Attachments: Book.patch, BookTest.patch
>
>
> According to the specification the method java.awt.print.Book.setPage throws:
> IndexOutOfBoundsException - if the specified page is not already in this Book
> NullPointerException - if the painter or page argument is null RI throws NPE if the painter or page argument is null while Harmony at first checks the condition for IndexOutOfBoundsException.
> ============ Test ===============
> import junit.framework.TestCase;
> import java.awt.print.*;
> import java.awt.*;
> public class test extends TestCase {
> public void test1 () {
> Book d=new Book();
> try {
> d.setPage(63, null, new PageFormat() );
> fail("NullPointerException should be thrown");
> } catch (NullPointerException e) {
> //expected
> }
> }
> public void test2 () {
> Book d=new Book();
> try {
> d.setPage(63, new testPrintable(), null);
> fail("NullPointerException should be thrown");
> } catch (NullPointerException e) {
> //expected
> }
> }
> }
> class testPrintable implements Printable {
> public int print(Graphics p0, PageFormat p1, int p2) {
> return 0;
> }
> }
> Output on Sun 1.5
> ==================
> ..
> Time: 0
> OK (2 tests)
> Output on Harmony_drlvm
> =======================
> .E.E
> Time: 0.016
> There were 2 errors:
> 1) test1(test)java.lang.IndexOutOfBoundsException: pageIndex is more than book
> size
> at java.awt.print.Book.setPage(Book.java:102)
> at test.test1(test.java:9)
> at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> 2) test2(test)java.lang.IndexOutOfBoundsException: pageIndex is more than book
> size
> at java.awt.print.Book.setPage(Book.java:102)
> at test.test2(test.java:19)
> at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 2, Failures: 0, Errors: 2
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira