Now throws the proper type of exception when a color name lookup fails.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3354 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ted V
2005-02-16 22:21:01 +00:00
parent 785259a4a8
commit ebf4d7cfa2
@@ -30,6 +30,8 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.Serializable; import java.io.Serializable;
import java.text.ParseException;
import com.samskivert.util.HashIntMap; import com.samskivert.util.HashIntMap;
import com.samskivert.util.StringUtil; import com.samskivert.util.StringUtil;
@@ -98,7 +100,7 @@ public class ColorPository implements Serializable
* in time critical situations. * in time critical situations.
*/ */
public int getColorId (String name) public int getColorId (String name)
throws Exception throws ParseException
{ {
// Check if the string is itself a number // Check if the string is itself a number
try { try {
@@ -120,13 +122,7 @@ public class ColorPository implements Serializable
} }
// That input wasn't a color // That input wasn't a color
// throw new ParseException("No color named '" + name + "'", 0);
// FIXME: I tried to make this throw a FormatException
// but it would never compile. For some reason, the
// "import java.text.FormatException;" line complained
// that FormatException wasn't part of java.text,
// contrary to the documentation.
throw new Exception("No color named '" + name + "'");
} }
/** Returns a random starting id from the entries in this /** Returns a random starting id from the entries in this