You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Ilya Okomin (JIRA)" <ji...@apache.org> on 2006/12/12 11:42:21 UTC
[jira] Created: (HARMONY-2622) [classlib][swing] Compatibility:
javax.swing.JMenuBar.processKeyBinding() for incorrect parameterds throws
NPE on Harmony instead of IllegalArgumentException on RI
[classlib][swing] Compatibility: javax.swing.JMenuBar.processKeyBinding() for incorrect parameterds throws NPE on Harmony instead of IllegalArgumentException on RI
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: HARMONY-2622
URL: http://issues.apache.org/jira/browse/HARMONY-2622
Project: Harmony
Issue Type: Bug
Components: Classlib
Reporter: Ilya Okomin
Priority: Minor
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: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (HARMONY-2622) [classlib][swing] Compatibility:
javax.swing.JMenuBar.processKeyBinding() for incorrect parameterds throws
NPE on Harmony instead of IllegalArgumentException on RI
Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-2622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12462821 ]
Vasily Zakharov commented on HARMONY-2622:
------------------------------------------
I'll look into this issue.
> [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
> Priority: Minor
>
> 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
[jira] Resolved: (HARMONY-2622) [classlib][swing] Compatibility:
javax.swing.JMenuBar.processKeyBinding() for incorrect parameterds throws
NPE on Harmony instead of IllegalArgumentException on RI
Posted by "Oliver Deakin (JIRA)" <ji...@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
[jira] Closed: (HARMONY-2622) [classlib][swing] Compatibility:
javax.swing.JMenuBar.processKeyBinding() for incorrect parameterds throws
NPE on Harmony instead of IllegalArgumentException on RI
Posted by "Oliver Deakin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-2622?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oliver Deakin closed HARMONY-2622.
----------------------------------
Verified by Vasily.
> [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
[jira] Commented: (HARMONY-2622) [classlib][swing] Compatibility:
javax.swing.JMenuBar.processKeyBinding() for incorrect parameterds throws
NPE on Harmony instead of IllegalArgumentException on RI
Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-2622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12463151 ]
Vasily Zakharov commented on HARMONY-2622:
------------------------------------------
Thanks Oliver, the patch is fine.
> [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
[jira] Updated: (HARMONY-2622) [classlib][swing] Compatibility:
javax.swing.JMenuBar.processKeyBinding() for incorrect parameterds throws
NPE on Harmony instead of IllegalArgumentException on RI
Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-2622?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vasily Zakharov updated HARMONY-2622:
-------------------------------------
Attachment: Harmony-2622-Test.patch
> [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
> 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
[jira] Commented: (HARMONY-2622) [classlib][swing] Compatibility:
javax.swing.JMenuBar.processKeyBinding() for incorrect parameterds throws
NPE on Harmony instead of IllegalArgumentException on RI
Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-2622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12462918 ]
Vasily Zakharov commented on HARMONY-2622:
------------------------------------------
Attached fix and test patches.
> [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
> 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
[jira] Updated: (HARMONY-2622) [classlib][swing] Compatibility:
javax.swing.JMenuBar.processKeyBinding() for incorrect parameterds throws
NPE on Harmony instead of IllegalArgumentException on RI
Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-2622?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vasily Zakharov updated HARMONY-2622:
-------------------------------------
Attachment: Harmony-2622.patch
> [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
> 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
[jira] Assigned: (HARMONY-2622) [classlib][swing] Compatibility:
javax.swing.JMenuBar.processKeyBinding() for incorrect parameterds throws
NPE on Harmony instead of IllegalArgumentException on RI
Posted by "Oliver Deakin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-2622?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oliver Deakin reassigned HARMONY-2622:
--------------------------------------
Assignee: Oliver Deakin
> [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