Bug 4725 - FontData spec should disallow null name (1GL34H3)
Summary: FontData spec should disallow null name (1GL34H3)
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Carolyn MacLeod CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-11 14:21 EDT by Carolyn MacLeod CLA
Modified: 2001-10-29 16:34 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carolyn MacLeod CLA 2001-10-11 14:21:57 EDT
In the spec for constructing a Font with a name, null names are not allowed:
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_NULL_ARGUMENT - if the name argument is null</li>

	But nothing is said in the spec for constructing a FontData, so a FontData with a null name is gleefully constructed.
	Of course, you can't do anything reasonable with this bogus FontData, and if you pass it to a Font you will blow up randomly.

	Suggest strongly that we javadoc the FontData constructor to throw the exception (and do it in the code).

	Also, same thing for FontData.setName - we currently allow null. We should spec and throw illegal arg.

NOTES:
Comment 1 Carolyn MacLeod CLA 2001-10-24 13:03:51 EDT
Interestingly, the implementation of fonts changed recently, and now the 
FontData constructor and setName actually throw a NullPointerException when 
null is given, which is pretty bad.
This change makes it all the more compelling to make this tiny spec change.
Since the spec already says that the argument can not be null, no correct 
program can be using this "feature", so we feel the change is justified.

Added new exception spec and now throw exception.
All platforms.
Comment 2 DJ Houghton CLA 2001-10-29 16:34:04 EST
PRODUCT VERSION:
	137