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

[jira] Resolved: (HARMONY-1595) [classlib][awt]Compatibility: java.awt.Font.getStringBounds() methods for null FontRenderContext returns bounds on Harmony and throws NPE on RI

     [ http://issues.apache.org/jira/browse/HARMONY-1595?page=all ]

Alexey Petrenko resolved HARMONY-1595.
--------------------------------------

    Resolution: Fixed

Thanks!
The patch has been applied.
Please verify.

> [classlib][awt]Compatibility: java.awt.Font.getStringBounds() methods for null FontRenderContext returns bounds on Harmony and throws NPE on RI
> -----------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1595
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1595
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Ilya Okomin
>         Assigned To: Alexey Petrenko
>            Priority: Minor
>         Attachments: Harmony-1595-test-upd.patch, Harmony-1595-test.patch, Harmony-1595-upd.patch, Harmony-1595.patch
>
>
> java.awt.Font.getStringBounds() methods for null FontRenderContext returns bounds on Harmony and throws NPE on RI.
> Spec says nothing about any exceptions for getStringBounds() methods.
> You can check this running next test case:
> -------------------test.java---------------------
> import junit.framework.TestCase;
> import java.awt.Font;
> import java.awt.font.FontRenderContext;
> import java.text.StringCharacterIterator;
> public class test extends TestCase {
>     public static void main(String[] args) {
>         junit.textui.TestRunner.run(test.class);
>     }
>     public void testRun() {
>         Font font = Font.decode("Arial");
>         try {
>             font.getStringBounds(new char[] { 'a' }, 0, 1,
>                     (FontRenderContext) null);
>             System.out.println("Fail: NullPointerException expected!");
>         }catch (Exception e) {
>             if (e instanceof NullPointerException) {
>                 System.out.println("Success: " + e);
>             } else {
>                 System.out.println("Fail: " + e);
>             }
>         }
>         try {
>             font.getStringBounds(new StringCharacterIterator("a"), 0, 1,
>                     (FontRenderContext) null);
>             System.out.println("Fail: NullPointerException expected!");
>         }catch (Exception e) {
>             if (e instanceof NullPointerException) {
>                 System.out.println("Success: " + e);
>             } else {
>                 System.out.println("Fail: " + e);
>             }
>         }
>         
>         String str = "str";
>         try {
>             font.getStringBounds(str, 0, 1, (FontRenderContext) null);
>             System.out.println("Fail: NullPointerException expected!");
>         }catch (Exception e) {
>             if (e instanceof NullPointerException) {
>                 System.out.println("Success: " + e);
>             } else {
>                 System.out.println("Fail: " + e);
>             }
>         }
>         try {
>             font.getStringBounds(str, (FontRenderContext) null);
>             System.out.println("Fail: NullPointerException expected!");
>         }catch (Exception e) {
>             if (e instanceof NullPointerException) {
>                 System.out.println("Success: " + e);
>             } else {
>                 System.out.println("Fail: " + e);
>             }
>         }
>     }
> }
> ---------------------------------------------
> ====== Output RI ====== 
> .Success: java.lang.NullPointerException
> Success: java.lang.NullPointerException
> Success: java.lang.NullPointerException
> Success: java.lang.NullPointerException
> Time: 2.183
> OK (1 test)
> ====== Output Harmony =======
> .Fail: NullPointerException expected!
> Fail: NullPointerException expected!
> Fail: NullPointerException expected!
> Fail: NullPointerException expected!
> Time: 0.36
> OK (1 test)
> Don't pay attention to the successful test pass - compare only output.

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