This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
ClasspathFontPeer allows null transform
- From: "Scott Gilbertson" <scottg at mantatest dot com>
- To: "graydon hoare" <graydon at redhat dot com>
- Cc: <java at gcc dot gnu dot org>
- Date: Wed, 28 Jan 2004 15:02:57 -0500
- Subject: ClasspathFontPeer allows null transform
I'm working on classpathifying the xlib peers so they'll work with the
latest code in cvs. It's apparently working, but only because of a hack.
ClasspathFontPeer doesn't put anything in its "transform" field when you
construct it with name,style,size. I therefore get a null pointer exception
in java.awt.Font.equals, which doesn't check for a null transform in either
or both fonts being compared.
Just for testing, my ClasspathFontPeer subclass overrides getTransform in
the following disgusting way:
public AffineTransform getTransform (Font font)
{
AffineTransform returnValue = super.getTransform (font);
if (returnValue == null)
returnValue = new AffineTransform ();
return returnValue;
}
I guess the possible "proper" approaches are:
1. make java.awt.Font.equals tolerant of a null transform in either or both
fonts
2. make java.awt.Font.getTransform so it returns an identity transform if
the peer returns null
3. change ClasspathFontPeer so it puts an identity transform in
"transform", rather than null
Got a preference?