Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 2162 invoked from network); 8 Jan 2007 14:05:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Jan 2007 14:05:48 -0000 Received: (qmail 98279 invoked by uid 500); 8 Jan 2007 14:05:55 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 98255 invoked by uid 500); 8 Jan 2007 14:05:55 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 98245 invoked by uid 99); 8 Jan 2007 14:05:55 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jan 2007 06:05:55 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jan 2007 06:05:47 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 8424371429F for ; Mon, 8 Jan 2007 06:05:27 -0800 (PST) Message-ID: <26963719.1168265127536.JavaMail.jira@brutus> Date: Mon, 8 Jan 2007 06:05:27 -0800 (PST) From: "Oliver Deakin (JIRA)" To: commits@harmony.apache.org Subject: [jira] Resolved: (HARMONY-2622) [classlib][swing] Compatibility: javax.swing.JMenuBar.processKeyBinding() for incorrect parameterds throws NPE on Harmony instead of IllegalArgumentException on RI In-Reply-To: <21222296.1165920141320.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-2622?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Oliver Deakin resolved HARMONY-2622. ------------------------------------ Resolution: Fixed Thanks Ilya and Vasily. Patch applied at revision r494074. Please check that the patch was applied as expected. > [classlib][swing] Compatibility: javax.swing.JMenuBar.processKeyBinding() for incorrect parameterds throws NPE on Harmony instead of IllegalArgumentException on RI > ------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: HARMONY-2622 > URL: https://issues.apache.org/jira/browse/HARMONY-2622 > Project: Harmony > Issue Type: Bug > Components: Classlib > Reporter: Ilya Okomin > Assigned To: Oliver Deakin > Priority: Minor > Attachments: Harmony-2622-Test.patch, Harmony-2622.patch > > > Method javax.swing.JMenuBar.processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) with params set (e ==null) && !(condition == JComponent.WHEN_IN_FOCUSED_WINDOW || JComponent.WHEN_FOCUSED || Component.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) throws NPE on Harmony while IllegalArgumentException is thrown on RI. > Spec keeps silence about any exception for this method. > Test to reproduce: > ---------------test.java--------------- > import java.awt.event.KeyEvent; > import javax.swing.JMenuBar; > import javax.swing.KeyStroke; > import junit.framework.TestCase; > import junit.textui.TestRunner; > public class test extends TestCase { > public static void main(String args[]) { > TestRunner.run(test.class); > } > private class MyJMenuBar extends JMenuBar { > public boolean processKeyBinding(KeyStroke ks, KeyEvent e, > int condition, boolean pressed) { > return super.processKeyBinding(ks, e, condition, pressed); > } > } > public void testNullEvent() { > MyJMenuBar jm = new MyJMenuBar(); > KeyStroke ks = (KeyStroke) KeyStroke.getKeyStroke('x'); > try { > System.out.println("pass: result = " > + jm.processKeyBinding(ks, null, -1, true)); > fail("IllegalArgumentException expected but wasn't thrown!"); > } catch (IllegalArgumentException e) { > // expected exception > } > } > } > ------------------------------ > Output RI: > ======== > . > Time: 1,172 > OK (1 test) > Output Harmony: > ============== > .E > Time: 2.173 > There was 1 error: > 1) testNullEvent(test)java.lang.NullPointerException > at javax.swing.JMenuBar.processKeyBinding(JMenuBar.java:191) > at test$MyJMenuBar.processKeyBinding(test.java) > at test.testNullEvent(test.java:26) > at java.lang.reflect.VMReflection.invokeMethod(Native Method) > at test.main(test.java:12) > FAILURES!!! > Tests run: 1, Failures: 0, Errors: 1 > I would like to add: in case, when condition is one of the appropriate values and event is null - RI works silently and Harmony throws NPE. But combination of incorrect params that was shown in the head should be taken into account to be compatible in order of thrown exceptions. -- 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