Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 75765 invoked from network); 26 Sep 2006 16:19:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Sep 2006 16:19:40 -0000 Received: (qmail 32558 invoked by uid 500); 26 Sep 2006 16:19:40 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 32454 invoked by uid 500); 26 Sep 2006 16:19:39 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 32443 invoked by uid 99); 26 Sep 2006 16:19:39 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Sep 2006 09:19:39 -0700 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests= Received: from [209.237.227.198] ([209.237.227.198:48875] helo=brutus.apache.org) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id 5F/C0-13661-A1359154 for ; Tue, 26 Sep 2006 09:19:39 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 621267142A1 for ; Tue, 26 Sep 2006 16:15:51 +0000 (GMT) Message-ID: <25441583.1159287351399.JavaMail.jira@brutus> Date: Tue, 26 Sep 2006 09:15:51 -0700 (PDT) From: "Ilya Okomin (JIRA)" To: harmony-commits@incubator.apache.org Subject: [jira] Updated: (HARMONY-1595) [classlib][awt]Compatibility: java.awt.Font.getStringBounds() methods for null FontRenderContext returns bounds on Harmony and throws NPE on RI In-Reply-To: <7545409.1159287230213.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/HARMONY-1595?page=all ] Ilya Okomin updated HARMONY-1595: --------------------------------- Attachment: Harmony-1595.patch Harmony-1595-test.patch Please try these fix and unit test. > [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 > Priority: Minor > Attachments: Harmony-1595-test.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