fix #2774 Refactor variable name and update log message

This commit is contained in:
Shinsuke Sugaya 2023-10-17 20:20:46 +09:00
parent 9ff28a173d
commit 2a473626cd

View file

@ -38,7 +38,7 @@ public class PathMapping extends BsPathMapping {
protected Pattern regexPattern;
protected BiFunction<String, Matcher, String> pathMapper;
protected BiFunction<String, Matcher, String> pathMapperFunc;
public String getId() {
return asDocMeta().id();
@ -62,14 +62,14 @@ public class PathMapping extends BsPathMapping {
}
final Matcher matcher = regexPattern.matcher(input);
if (matcher.find()) {
if (pathMapper == null) {
if (pathMapperFunc == null) {
final String replacement = StringUtil.isNotBlank(getReplacement()) ? getReplacement() : StringUtil.EMPTY;
pathMapper = pathMappingHelper.createPathMatcher(matcher, replacement);
pathMapperFunc = pathMappingHelper.createPathMatcher(matcher, replacement);
}
try {
return pathMapper.apply(input, matcher);
return pathMapperFunc.apply(input, matcher);
} catch (final Exception e) {
logger.warn("Failed to apply {}", pathMapper, e);
logger.warn("Failed to apply {} to {}.", regexPattern.pattern(), input, e);
}
}
return input;