You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Denis Kishenko (JIRA)" <ji...@apache.org> on 2006/12/04 15:00:21 UTC

[jira] Created: (HARMONY-2433) [classlib][awt] Different order of exceptions on j.a.print.Book.setPage(,,)

[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

        

[jira] Resolved: (HARMONY-2433) [classlib][awt] Different order of exceptions on j.a.print.Book.setPage(,,)

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

        

[jira] Commented: (HARMONY-2433) [classlib][awt] Different order of exceptions on j.a.print.Book.setPage(,,)

Posted by "Andrey Pavlenko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-2433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12465086 ] 

Andrey Pavlenko commented on HARMONY-2433:
------------------------------------------

Verified, the patches have been applied as expected. 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

        

[jira] Commented: (HARMONY-2433) [classlib][awt] Different order of exceptions on j.a.print.Book.setPage(,,)

Posted by "Andrey Pavlenko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-2433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12464944 ] 

Andrey Pavlenko commented on HARMONY-2433:
------------------------------------------

The license has been attached. Please apply the patch for the test.

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

        

[jira] Commented: (HARMONY-2433) [classlib][awt] Different order of exceptions on j.a.print.Book.setPage(,,)

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-2433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12464988 ] 

Mark Hindess commented on HARMONY-2433:
---------------------------------------

Sorry, I missed the "svn add" but I did it a few moments later in r495765.  (The comment out the license was intended to be for future reference.)

Please confirm everything is as expected.



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

        

[jira] Closed: (HARMONY-2433) [classlib][awt] Different order of exceptions on j.a.print.Book.setPage(,,)

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

        

[jira] Updated: (HARMONY-2433) [classlib][awt] Different order of exceptions on j.a.print.Book.setPage(,,)

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

Andrey Pavlenko updated HARMONY-2433:
-------------------------------------

    Attachment: BookTest.patch

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

        

[jira] Updated: (HARMONY-2433) [classlib][awt] Different order of exceptions on j.a.print.Book.setPage(,,)

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

Alexei Zakharov updated HARMONY-2433:
-------------------------------------

    Patch Info: [Patch Available]

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

        

[jira] Updated: (HARMONY-2433) [classlib][awt] Different order of exceptions on j.a.print.Book.setPage(,,)

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

Andrey Pavlenko updated HARMONY-2433:
-------------------------------------

    Attachment: Book.patch
                BookTest.patch

Attaching patch and regression test.

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