Re: AxisScale.setFont()

Hi Mathias-

Mathias Stümpert wrote:
> 
> Hi all,
> 
> I think I found a small bug in the setFont() method of AxisScale. The
> method asks if the specified font is null but nevertheless throws a
> NullPointerException by calling getSize() on the null-font. Here?s the
> mentioned piece of code:
> 
> if ((labelFont == null && oldFont != null) ||
> !labelFont.equals(oldFont))
>     {
>       labelSize = labelFont.getSize();
>       try {
>         scalarMap.makeScale();  // update the display
>       }
>       catch (VisADException ve) {;}
>     }
> 
> I found that because I wanted to set the font to the original font which
> is null. Would be great if you could fix this.

Yes, this is a bug.  Don't know what I was thinking.  The
comparison should be:

    if (labelFont != null && !labelFont.equals(oldFont))

I'll update the repository and the fix will be in the next
release.

Don
*************************************************************
Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************


  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: