From d70baf13700b6cbe664249322559b64dc44303c2 Mon Sep 17 00:00:00 2001 From: Henri Yandell Date: Thu, 7 Jul 2011 03:47:17 +0000 Subject: [PATCH] Moving to an IllegalArgumentException: LANG-710 git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1143643 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/lang3/text/translate/NumericEntityUnescaper.java | 4 ++-- .../lang3/text/translate/NumericEntityUnescaperTest.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java b/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java index e87993a58..739db3227 100644 --- a/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java +++ b/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java @@ -46,7 +46,7 @@ public class NumericEntityUnescaper extends CharSequenceTranslator { * * For example, to support numeric entities without a ';': * new NumericEntityUnescaper(NumericEntityUnescaper.OPTION.semiColonOptional) - * and to throw a RuntimeException when they're missing: + * and to throw an IllegalArgumentException when they're missing: * new NumericEntityUnescaper(NumericEntityUnescaper.OPTION.errorIfNoSemiColon) * * Note that the default behaviour is to ignore them. @@ -109,7 +109,7 @@ public class NumericEntityUnescaper extends CharSequenceTranslator { return 0; } else if(isSet(OPTION.errorIfNoSemiColon)) { - throw new RuntimeException("Semi-colon required at end of numeric entity"); + throw new IllegalArgumentException("Semi-colon required at end of numeric entity"); } } diff --git a/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java b/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java index 6604bdebb..2310dcf52 100644 --- a/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java +++ b/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java @@ -66,8 +66,8 @@ public class NumericEntityUnescaperTest extends TestCase { try { result = neu.translate(input); - fail("RuntimeException expected"); - } catch(RuntimeException re) { + fail("IllegalArgumentException expected"); + } catch(IllegalArgumentException iae) { // expected } }