whoops - needed to catch some exceptions

This commit is contained in:
Eric J. Bowersox 2004-08-02 22:57:40 +00:00
parent 116a67376d
commit d5243d7af2
2 changed files with 24 additions and 2 deletions

View File

@ -91,7 +91,18 @@ public class EmoticonTagHandler implements Rewriter
public MarkupData rewrite(String data, RewriterServices svc) public MarkupData rewrite(String data, RewriterServices svc)
{ {
logger.debug("EmoticonTagHandler looking at: " + data); logger.debug("EmoticonTagHandler looking at: " + data);
RE r = new RE("ei:\\s*(\\w+)(?:\\s*/)?\\s*"); RE r = null;
try
{ // compile regular expression
r = new RE("ei:\\s*(\\w+)(?:\\s*/)?\\s*");
} // end try
catch (RESyntaxException e)
{ // something wicked this way comes
logger.fatal("WTF?!?!?!?",e);
} // end catch
if (!(r.match(data))) if (!(r.match(data)))
return null; return null;
String icon_name = r.getParen(1); String icon_name = r.getParen(1);

View File

@ -149,7 +149,18 @@ public class EmoticonManager
public String rewriteText(RequestOutput out, String txt) public String rewriteText(RequestOutput out, String txt)
{ {
RE r = new RE("<ei:\\s*(\\w+)(?:\\s*/)?\\s*>"); RE r = null;
try
{ // create the regexp
r = new RE("<ei:\\s*(\\w+)(?:\\s*/)?\\s*>");
} // end try
catch (RESyntaxException e)
{ // something wicked this way comes
logger.fatal("WTF?!?!?!?",e);
} // end catch
if (!(r.match(txt))) if (!(r.match(txt)))
{ // null it out { // null it out
logger.debug("EmoticonManager.rewriteText matched nothing at all"); logger.debug("EmoticonManager.rewriteText matched nothing at all");