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] Commented: (HARMONY-1464) [classlib][awt]compatibility:awt.font.TextLayout() constructors with null parameters have behavior that differs from RI
Date Tue, 19 Sep 2006 07:32:23 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-1464?page=comments#action_12435713 ] 
            
Mark Hindess commented on HARMONY-1464:
---------------------------------------

Thanks.  I've applied the new patch in r447771.  Please confirm that this issue is now resolved.


> [classlib][awt]compatibility:awt.font.TextLayout() constructors with null parameters
have behavior that differs from RI
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1464
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1464
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Ilya Okomin
>         Assigned To: Mark Hindess
>            Priority: Trivial
>         Attachments: Harmony-1464-update.diff, harmony-1464.patch, harmony-test-1464-1465.patch
>
>
> There is no mentions about any exceptions in the java api spec but RI throws java.lang.IllegalArgumentException
if constructor parameters(except FontRenderContext) are null while Harmony throws java.lang.NullPointerException.
In case of FontRenderContext is null RI throws NPE while Harmony doesn't throws any exception
at all. 
> Next test case passes on RI and fails on Harmony:
> ----------------------test.java---------------------------
> import junit.framework.TestCase;
> import java.awt.Font;
> import java.awt.font.*;
> import java.text.AttributedString;
> import java.text.AttributedCharacterIterator.Attribute;
> import java.util.*;
> public class test extends TestCase {
>     private final Font f = new Font("dialog", Font.PLAIN, 12);
>     
>     public static void main(String[] args) {
>     }
>     public void testTextLayoutConstructorConstraintsRun() throws Exception{
>         
>         try{
>             new TextLayout(null, (Font)null, null);
>         } catch (IllegalArgumentException e) {
>                 // expected
>         }
>         try{
>             new TextLayout(null, f, null);
>         } catch (IllegalArgumentException e) {
>             // expected
>         }
>         
>         try{
>             new TextLayout("", f, null);
>         } catch (IllegalArgumentException e) {
>             // expected
>         }
>         try{
>             new TextLayout("aa", f, null);
>         } catch (NullPointerException e) {
>             // expected
>         }
>         try{
>             new TextLayout(null, null);
>         } catch (IllegalArgumentException e) {
>             // expected
>         }
>         AttributedString as = new AttributedString("test");
>         as.addAttribute(TextAttribute.FONT, f, 0, 2 );
>         try{
>             new TextLayout(as.getIterator(), null);
>         } catch (NullPointerException e) {
>             // expected
>         }
>         
>         try {
>             new TextLayout(null, (Map<? extends Attribute,?>)null, (FontRenderContext)
null);
>         } catch (IllegalArgumentException e) {
>             System.out.println("success: " + e.getMessage());
>             // as expected
>         }
>         try {
>             new TextLayout(null, (Map<? extends Attribute,?>)new HashMap(), (FontRenderContext)
null);
>         } catch (IllegalArgumentException e) {
>             // as expected
>         }
>         try {
>             new TextLayout("aa", (Map<? extends Attribute,?>)new HashMap(), (FontRenderContext)
null);
>         } catch (NullPointerException e) {
>             // as expected
>         }
>         
>         try{
>             new TextLayout("", (Map<? extends Attribute,?>)new HashMap(), (FontRenderContext)
null);
>         } catch (IllegalArgumentException e) {
>             // as expected
>             System.out.println("success: " + e.getMessage());
>         }
>         
>     }
>     
> }
> ----------------------------------------------------------------
> I have investigated this problem and prepared the patch that will provide parameters
checks in TextLayout constructors to be compatible with RI.
> Also I found compatibility issue in Font.getLineMetrics() that related to this issue.
For null FontRenderContext parameter RI Font.getLineMetrics() call throws NullPointerException
while Harmony doesn't.
> I'll create jira issue for that.

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