I have a method for swapping of matched part of string with current date:
public static String swapDateOnConstant(String value) {
LOGGER.info("Swap date in string: " + value);
String patternString = "<(.*)>";
Pattern pattern = Pattern.compile(patternString);
Matcher matcher = pattern.matcher(value);
String dateFormat = matcher.group(0);
dateFormat = dateFormat.substring(1, dateFormat.length() - 1)
.replaceAll("D", "d")
.replaceAll("m", "M")
.replaceAll("Y", "y");
String currentDate = DateTimeTools.getCurrentDateInFormat(dateFormat);
value = value.replaceAll(patternString, currentDate);
return value;}
Input string value is: \<MM-DD-YY> CITI
When I go through this method in debug method everything is ok but when I's run in normal mode
I receive and exception java.lang.IllegalStateException: No match found
from line String dateFormat = matcher.group(0);
I'm confused. Any idea what is going on here ?