whoops 3
authorzapata <zapata>
Thu, 10 Aug 2006 20:03:51 +0000 (20:03 +0000)
committerzapata <zapata>
Thu, 10 Aug 2006 20:03:51 +0000 (20:03 +0000)
source/mir/misc/StringUtil.java

index 469c1ab..08f293a 100755 (executable)
@@ -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