harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Kishenko (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2433) [classlib][awt] Different order of exceptions on j.a.print.Book.setPage(,,)
Date Mon, 04 Dec 2006 14:00:21 GMT
[classlib][awt] Different order of exceptions on j.a.print.Book.setPage(,,)
---------------------------------------------------------------------------

                 Key: HARMONY-2433
                 URL: http://issues.apache.org/jira/browse/HARMONY-2433
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Denis Kishenko


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: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message