You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mark Hindess (JIRA)" <ji...@apache.org> on 2006/09/19 12:26:47 UTC
[jira] Closed: (HARMONY-1465)
[classlib][awt]compatibility:awt.Font.getLineMetrics() for null
FontRenderContext returns LineMetrics instanse on Harmony and throws NPE on
RI
[ http://issues.apache.org/jira/browse/HARMONY-1465?page=all ]
Mark Hindess closed HARMONY-1465.
---------------------------------
Resolution: Fixed
Fixed by patches in 1464.
> [classlib][awt]compatibility:awt.Font.getLineMetrics() for null FontRenderContext returns LineMetrics instanse on Harmony and throws NPE on RI
> ----------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-1465
> URL: http://issues.apache.org/jira/browse/HARMONY-1465
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Ilya Okomin
> Assigned To: Mark Hindess
> Priority: Minor
>
> There is nothing written in the spec about the exceptions but if the FontRenderContext parameter is null awt.Font.getLineMetrics() returns LineMetrics instanse on Harmony while NPE is thrown on RI.
> 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 testFontgetLineMetricsWithNullFRC(){
> final String str = "test";
> try{
> f.getLineMetrics(str, null);
> fail("NullPointerException expected but wasn't thrown!");
> }catch (NullPointerException e) {
> // as expected
> }
> try{
> f.getLineMetrics(str, 1, 3, null);
> fail("NullPointerException expected but wasn't thrown!");
> }catch (NullPointerException e) {
> // as expected
> }
> try{
> f.getLineMetrics(str.toCharArray(), 1, 3, null);
> fail("NullPointerException expected but wasn't thrown!");
> }catch (NullPointerException e) {
> // as expected
> }
> try{
> AttributedString as = new AttributedString("test");
> as.addAttribute(TextAttribute.FONT, f, 0, 2 );
> f.getLineMetrics(as.getIterator(), 1, 3, null);
> fail("NullPointerException expected but wasn't thrown!");
> }catch (NullPointerException e) {
> // as expected
> }
>
> }
>
> }
> ---------------------------------------------------------------
--
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