SUGGESTED FIX
------- KeyStroke.java -------
*** /tmp/sccs.aWaOzi Sat Sep 20 14:56:21 2003
--- KeyStroke.java Sat Sep 20 14:56:11 2003
***************
*** 202,207 ****
--- 202,208 ----
* obtained for all three types of KeyEvent.
*
* @param anEvent the KeyEvent from which to obtain the KeyStroke
+ * @throws NullPointerException if <code>anEvent</code> is null
* @return the KeyStroke that precipitated the event
*/
public static KeyStroke getKeyStrokeForEvent(KeyEvent anEvent) {
------- AWTKeyStroke.java -------
*** /tmp/sccs.EjaGAi Sat Sep 20 15:00:12 2003
--- AWTKeyStroke.java Sat Sep 20 14:54:42 2003
***************
*** 402,407 ****
--- 402,408 ----
*
* @param anEvent the <code>KeyEvent</code> from which to
* obtain the <code>AWTKeyStroke</code>
+ * @throws NullPointerException if <code>anEvent</code> is null
* @return the <code>AWTKeyStroke</code> that precipitated the event
*/
public static AWTKeyStroke getAWTKeyStrokeForEvent(KeyEvent anEvent) {
###@###.### 2003-09-20
|
EVALUATION
Currently, null is not checked, so an NPE is thrown from within the function.
The other versions of getAWTKeyStroke throw IAE when a parameter is null.
Perhaps it would be best to match the other functions in this class.
Commit to fix in Tiger (JCK spec).
###@###.### 2002-08-28
We should also change the doc for javax.swing.KeyStroke.getKeyStrokeForEvent
in the same way. The two methods should match each other in spec and behavior.
Swing's KeyStroke has always thrown an NPE in this case. I don't think we
ought to change this behavior now. Instead, it might be better to document
the existing behavior in AWTKeyStroke and KeyStroke:
@throws NullPointerException if <code>anEvent</code> is null
###@###.### 2003-03-17
Note: when we do this, we should also specify in the equals() method that
false will be returned if anObject is null.
###@###.### 2003-05-22
Specification for Object.equals mathod explains null parameter value behavior:
"* For any non-null reference value x, x.equals(null) should return false."
###@###.### 2003-05-22
|