From f078d7c8505934e93e99636249979667c40a3dac Mon Sep 17 00:00:00 2001 From: zapata Date: Thu, 10 Aug 2006 20:03:51 +0000 Subject: [PATCH] whoops 3 --- source/mir/misc/StringUtil.java | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/source/mir/misc/StringUtil.java b/source/mir/misc/StringUtil.java index 469c1abb..08f293af 100755 --- a/source/mir/misc/StringUtil.java +++ b/source/mir/misc/StringUtil.java @@ -31,6 +31,7 @@ import org.apache.oro.text.regex.Perl5Matcher; import org.apache.oro.text.regex.Perl5Substitution; import org.apache.oro.text.regex.Util; import org.apache.oro.text.regex.Perl5Compiler; +import org.apache.oro.text.regex.MalformedPatternException; import java.text.NumberFormat; import java.util.Calendar; @@ -38,6 +39,8 @@ import java.util.Date; import java.util.GregorianCalendar; import java.util.TimeZone; +import mir.util.UtilFailure; + /** */ public final class StringUtil { @@ -221,16 +224,18 @@ public final class StringUtil { return calendar.getTime(); } - public static String regexpReplace(String anInput, String anExpression, String aReplacement) throws Exception { + public static String regexpReplace(String anInput, String anExpression, String aReplacement) throws UtilFailure { Perl5Matcher matcher = new Perl5Matcher(); - return Util.substitute( - matcher, new Perl5Compiler().compile(anExpression), - new Perl5Substitution(aReplacement), anInput, - Util.SUBSTITUTE_ALL); - } - - - -} + try { + return Util.substitute( + matcher, new Perl5Compiler().compile(anExpression), + new Perl5Substitution(aReplacement), anInput, + Util.SUBSTITUTE_ALL); + } + catch (MalformedPatternException e) { + throw new UtilFailure(e); + } + } +} \ No newline at end of file -- 2.11.0