This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI [gui] Make EventQueue.postEvent(null) fail fast


Hi,

Another merglet from GNU Classpath.

The following makes EventQueue.postEvent() throw a NullPointerException
immediately when it gets a null event.

2004-06-27  Mark Wielaard  <mark@klomp.org>

       * java/awt/EventQueue.java (postEvent): Throw NullPointerException
       when argument is null.

In the past a null event could slip through and only throw a
NullPointerException much later during event processing making debugging
horribly complicated. Committed to the gui branch.

Cheers,

Mark

--- java/awt/EventQueue.java    26 Jan 2004 16:33:01 -0000      1.16
+++ java/awt/EventQueue.java    27 Jun 2004 10:45:28 -0000
@@ -161,6 +161,9 @@
    */
   public synchronized void postEvent(AWTEvent evt)
   {
+    if (evt == null)
+      throw new NullPointerException();
+
     if (next != null)
       {
         next.postEvent(evt);

Attachment: signature.asc
Description: This is a digitally signed message part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]