udunits/src/main/java/ucar/units/UnitDBImpl.java
public void addUnit(final Unit unit) throws UnitExistsException,
			NameException {
		if (unit.getName() == null) {
			throw new NameException("Unit name can't be null");
		}
		addByName(unit.getName(), unit);
		addByName(unit.getPlural(), unit);
		addBySymbol(unit.getSymbol(), unit);
		unitSet.add(unit);
	}
public void addUnit(final Unit unit) throws UnitExistsException,
			NameException {
		if (unit.getName() == null) {
			throw new NameException("Unit name can't be null");
		}
		addByName(unit.getName(), unit);
		addByName(unit.getPlural(), unit);
		addBySymbol(unit.getSymbol(), unit);
		unitSet.add(unit);
	}
public void addUnit ( final Unit unit ) throws UnitExistsException , NameException { if ( unit . getName ( ) == null ) { throw new NameException ( "Unit name can't be null" ) ; } addByName ( unit . getName ( ) , unit ) ; addByName ( unit . getPlural ( ) , unit ) ; addBySymbol ( unit . getSymbol ( ) , unit ) ; unitSet . add ( unit ) ; }
Adds a unit to the database.

@param unit
The unit to be added.
@throws UnitExistsException
Another unit with the same name or symbol already exists in
the database.
@throws NameException
Bad unit name.
Adds a unit to the database .