From ebf4d7cfa2306cffd13a61296ec28af5f46960d9 Mon Sep 17 00:00:00 2001 From: Ted V Date: Wed, 16 Feb 2005 22:21:01 +0000 Subject: [PATCH] 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 --- .../com/threerings/media/image/ColorPository.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/java/com/threerings/media/image/ColorPository.java b/src/java/com/threerings/media/image/ColorPository.java index 050787bef..99b3b20cc 100644 --- a/src/java/com/threerings/media/image/ColorPository.java +++ b/src/java/com/threerings/media/image/ColorPository.java @@ -30,6 +30,8 @@ import java.io.IOException; import java.io.InputStream; import java.io.Serializable; +import java.text.ParseException; + import com.samskivert.util.HashIntMap; import com.samskivert.util.StringUtil; @@ -98,7 +100,7 @@ public class ColorPository implements Serializable * in time critical situations. */ public int getColorId (String name) - throws Exception + throws ParseException { // Check if the string is itself a number try { @@ -120,13 +122,7 @@ public class ColorPository implements Serializable } // That input wasn't a color - // - // 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 + "'"); + throw new ParseException("No color named '" + name + "'", 0); } /** Returns a random starting id from the entries in this