From 0eb1ecb1b7111d221d1ac4f80d20ed5a811ec447 Mon Sep 17 00:00:00 2001 From: huangchengxing <841396397@qq.com> Date: Tue, 8 Nov 2022 18:09:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=A4=84=E7=90=86=E5=99=A8?= =?UTF-8?q?=E9=9D=9E=E7=A9=BA=E6=A0=A1=E9=AA=8C=E6=97=B6=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/hutool/core/text/PlaceholderParser.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hutool-core/src/main/java/cn/hutool/core/text/PlaceholderParser.java b/hutool-core/src/main/java/cn/hutool/core/text/PlaceholderParser.java index 50ec2a4f3..c01cd6116 100644 --- a/hutool-core/src/main/java/cn/hutool/core/text/PlaceholderParser.java +++ b/hutool-core/src/main/java/cn/hutool/core/text/PlaceholderParser.java @@ -57,10 +57,11 @@ public class PlaceholderParser implements UnaryOperator { * @param close 占位符结束符号,不允许为空 * @param escape 转义符 */ - public PlaceholderParser(UnaryOperator processor, String open, String close, char escape) { + public PlaceholderParser( + final UnaryOperator processor, final String open, final String close, final char escape) { Assert.isFalse(StrChecker.isEmpty(open), "开始符号不能为空"); Assert.isFalse(StrChecker.isEmpty(close), "结束符号不能为空"); - this.processor = processor; + this.processor = Objects.requireNonNull(processor); this.open = open; this.openLength = open.length(); this.close = close; @@ -75,7 +76,8 @@ public class PlaceholderParser implements UnaryOperator { * @param open 占位符开始符号,不允许为空 * @param close 占位符结束符号,不允许为空 */ - public PlaceholderParser(UnaryOperator processor, String open, String close) { + public PlaceholderParser( + final UnaryOperator processor, final String open, final String close) { this(processor, open, close, '\\'); } @@ -86,8 +88,7 @@ public class PlaceholderParser implements UnaryOperator { * @return 处理后的字符串 */ @Override - public String apply(String text) { - Objects.requireNonNull(processor); + public String apply(final String text) { if (StrChecker.isEmpty(text)) { return StrChecker.EMPTY; }