You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by ca...@apache.org on 2007/11/27 03:46:34 UTC

svn commit: r598494 - in /xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events: DOMKeyboardEvent.java DOMMouseEvent.java

Author: cam
Date: Mon Nov 26 18:46:33 2007
New Revision: 598494

URL: http://svn.apache.org/viewvc?rev=598494&view=rev
Log:
Avoid NPE when calling DOMMouseEvent.initMouseEvent(), and when trying
to inspect the modifier state of an event object before it has been
initialised.

Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DOMKeyboardEvent.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DOMMouseEvent.java

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DOMKeyboardEvent.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DOMKeyboardEvent.java?rev=598494&r1=598493&r2=598494&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DOMKeyboardEvent.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DOMKeyboardEvent.java Mon Nov 26 18:46:33 2007
@@ -234,7 +234,7 @@
     /**
      * The modifier keys in effect at the time of the event.
      */
-    protected HashSet modifierKeys;
+    protected HashSet modifierKeys = new HashSet();
 
     /**
      * The identifier string for the key.
@@ -322,7 +322,7 @@
         initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, 0);
         keyIdentifier = keyIdentifierArg;
         keyLocation = keyLocationArg;
-        modifierKeys = new HashSet();
+        modifierKeys.clear();
         String[] modifiers = split(modifiersList);
         for (int i = 0; i < modifiers.length; i++) {
             modifierKeys.add(modifiers[i]);
@@ -361,7 +361,7 @@
                                0);
         keyIdentifier = keyIdentifierArg;
         keyLocation = keyLocationArg;
-        modifierKeys = new HashSet();
+        modifierKeys.clear();
         String[] modifiers = split(modifiersList);
         for (int i = 0; i < modifiers.length; i++) {
             modifierKeys.add(modifiers[i]);

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DOMMouseEvent.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DOMMouseEvent.java?rev=598494&r1=598493&r2=598494&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DOMMouseEvent.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/events/DOMMouseEvent.java Mon Nov 26 18:46:33 2007
@@ -44,7 +44,7 @@
     /**
      * The modifier keys in effect at the time of the event.
      */
-    protected HashSet modifierKeys;
+    protected HashSet modifierKeys = new HashSet();
 
     /**
      * DOM: <code>screenX</code> indicates the horizontal coordinate
@@ -265,7 +265,7 @@
         clientY = clientYArg;
         button = buttonArg;
         relatedTarget = relatedTargetArg;
-        modifierKeys = new HashSet();
+        modifierKeys.clear();
         String[] modifiers = split(modifiersList);
         for (int i = 0; i < modifiers.length; i++) {
             modifierKeys.add(modifiers[i]);