harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Hindess (JIRA)" <j...@apache.org>
Subject [jira] Closed: (HARMONY-2433) [classlib][awt] Different order of exceptions on j.a.print.Book.setPage(,,)
Date Tue, 16 Jan 2007 10:10:27 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-2433?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Mark Hindess closed HARMONY-2433.
---------------------------------


Verified.  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, BookTest.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

        

Mime
View raw message