returnval = USERNAME.matcher(returnval).replaceAll(username); returnval = PASSWORD.matcher(returnval).replaceAll(password); returnval = CN.matcher(returnval).replaceAll(dnfields.getField(DNFieldExtractor.CN, 0)); returnval = OU.matcher(returnval).replaceAll(dnfields.getField(DNFieldExtractor.OU, 0)); returnval = O.matcher(returnval).replaceAll(dnfields.getField(DNFieldExtractor.O, 0)); returnval = C.matcher(returnval).replaceAll(dnfields.getField(DNFieldExtractor.C, 0)); returnval = DATE.matcher(returnval).replaceAll(currentdate);  returnval = NEWLINE.matcher(returnval).replaceAll(newline);
try { returnval = USERNAME.matcher(returnval).replaceAll(username); returnval = PASSWORD.matcher(returnval).replaceAll(password); returnval = CN.matcher(returnval).replaceAll(dnfields.getField(DNFieldExtractor.CN, 0)); returnval = OU.matcher(returnval).replaceAll(dnfields.getField(DNFieldExtractor.OU, 0)); returnval = O.matcher(returnval).replaceAll(dnfields.getField(DNFieldExtractor.O, 0)); returnval = C.matcher(returnval).replaceAll(dnfields.getField(DNFieldExtractor.C, 0)); returnval = DATE.matcher(returnval).replaceAll(currentdate); returnval = NEWLINE.matcher(returnval).replaceAll(newline); } catch (IllegalArgumentException e) { log.error("Error creating message for username: "+username+", password: "+password+", dn: "+dn+", altname: "+subjectaltname+", email: "+email); throw e; }
    public String getMessage(String username, String password, String dn, String subjectaltname,        String email) throws Exception {        String returnval = message;        DNFieldExtractor dnfields = new DNFieldExtractor(dn, DNFieldExtractor.TYPE_SUBJECTDN);        // DNFieldExtractor subaltnamefields = new DNFieldExtractor(dn,DNFieldExtractor.TYPE_SUBJECTALTNAME);        String currentdate = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT)                                       .format(new Date());        String newline = System.getProperty("line.separator");        returnval = USERNAME.matcher(returnval).replaceAll(username);        returnval = PASSWORD.matcher(returnval).replaceAll(password);        returnval = CN.matcher(returnval).replaceAll(dnfields.getField(DNFieldExtractor.CN, 0));        returnval = OU.matcher(returnval).replaceAll(dnfields.getField(DNFieldExtractor.OU, 0));        returnval = O.matcher(returnval).replaceAll(dnfields.getField(DNFieldExtractor.O, 0));        returnval = C.matcher(returnval).replaceAll(dnfields.getField(DNFieldExtractor.C, 0));        returnval = DATE.matcher(returnval).replaceAll(currentdate);        returnval = NEWLINE.matcher(returnval).replaceAll(newline);        return returnval;    }