classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] invalidate Label on setText


From: Thomas Fitzsimmons
Subject: Re: [cp-patches] invalidate Label on setText
Date: Sun, 21 Aug 2005 11:25:48 -0400

On Sun, 2005-08-21 at 13:50 +0200, Mark Wielaard wrote:
> On Sun, 2005-08-21 at 13:19 +0200, Mark Wielaard wrote:
> > This should probably should be
> > 
> >     if ((this.text == null && text != null)
> >         || (! this.text.equals(text)))
> > 
> > Although invalidating whenever this.text != text probably doesn't hurt.
> 
> Ugh, I meant
> 
>     if ((this.text == null && text != null)
>         || (this.text != null && ! this.text.equals(text)))
> 
> Don't want to get NullPointerExceptions here.

You're right.  Fixed:

2005-08-21  Thomas Fitzsimmons  <address@hidden>

        * java/awt/Label.java (setText): Refine text inequality test.

Index: java/awt/Label.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Label.java,v
retrieving revision 1.20
diff -u -r1.20 Label.java
--- java/awt/Label.java 21 Aug 2005 04:00:14 -0000      1.20
+++ java/awt/Label.java 21 Aug 2005 15:28:06 -0000
@@ -215,7 +215,8 @@
 public synchronized void
 setText(String text)
 {
-  if (this.text != text)
+  if ((this.text == null && text != null)
+      || (this.text != null && ! this.text.equals(text)))
     {
       this.text = text;
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]