try {
String condition = (String) null;
int i = matchName.indexOf('=");
if (i != -1) {
condition = matchName.substring(i + 1);
matchName = matchName.substring(0, i);
}
for (i = 0; i < packages.size(); i++) {
String className = (String) packages.elementAt(i) + matchName;
try {
MatcherConfigImpl configImpl = new MatcherConfigImpl();
configImpl.setMatcherName(matchName);
configImpl.setCondition(condition);
configImpl.setMailetContext(mailetContext);
Matcher matcher = (Matcher) Thread.currentThread().getContextClassLoader().loadClass(className).newInstance();
matcher.init(configImpl);
return matcher;
} catch (ClassNotFoundException cnfe) {
//do this so we loop through all the packages
}
}
StringBuffer exceptionBuffer =
new StringBuffer(128)
.append("Requested matcher not found: ")
.append(matchName)
.append(". looked in ")
.append(packages.toString());
throw new ClassNotFoundException(exceptionBuffer.toString());
} catch (MessagingException me) {
throw me;
} catch (Exception e) {
StringBuffer exceptionBuffer =
new StringBuffer(128).append("Could not load matcher (").append(matchName).append(
")");
throw new MailetException(exceptionBuffer.toString(), e);
}