This is an automated email from the ASF dual-hosted git repository.

dengliming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new efd5f41e38 [type: feature] Support `isBlank` (#4983)
efd5f41e38 is described below

commit efd5f41e384536c5fbf90d4976632ad9b6b92c8c
Author: Kerwin Bryant <[email protected]>
AuthorDate: Thu Aug 17 11:14:21 2023 +0800

    [type: feature] Support `isBlank` (#4983)
    
    * Support `isBlank`
    
    * Migrate upgrade scripts to 2.6.1
    
    * Complete the modification suggestions proposed by @moremind
    
    * Complete the modification suggestions proposed by @moremind
    
    * Create 2.6.0-upgrade-2.6.1-og.sql
    
    ---------
    
    Co-authored-by: likeguo <[email protected]>
    Co-authored-by: dragon-zhang <[email protected]>
    Co-authored-by: Liming Deng <[email protected]>
    Co-authored-by: moremind <[email protected]>
---
 db/init/mysql/schema.sql                           |  1 +
 db/init/og/create-table.sql                        |  1 +
 db/init/oracle/schema.sql                          |  5 ++++-
 db/init/pg/create-table.sql                        |  1 +
 db/upgrade/2.6.0-upgrade-2.6.1-mysql.sql           | 19 +++++++++++++++++
 db/upgrade/2.6.0-upgrade-2.6.1-og.sql              | 19 +++++++++++++++++
 db/upgrade/2.6.0-upgrade-2.6.1-oracle.sql          | 20 ++++++++++++++++++
 db/upgrade/2.6.0-upgrade-2.6.1-pg.sql              | 20 ++++++++++++++++++
 db/upgrade/upgrade-guide.md                        | 24 ++++++++++++++++++++++
 .../shenyu/admin/model/dto/RuleConditionDTO.java   |  1 -
 .../shenyu/admin/service/SelectorService.java      |  1 -
 .../src/main/resources/sql-script/h2/schema.sql    |  1 +
 .../apache/shenyu/common/enums/OperatorEnum.java   |  9 ++++++--
 ...redicateJudge.java => BlankPredicateJudge.java} | 23 +++++++++------------
 .../base/condition/judge/PredicateJudge.java       |  1 +
 .../condition/judge/PredicateJudgeFactory.java     | 14 ++++++++-----
 ...enyu.plugin.base.condition.judge.PredicateJudge |  3 ++-
 .../condition/judge/PredicateJudgeFactoryTest.java | 10 ++++++++-
 18 files changed, 148 insertions(+), 25 deletions(-)

diff --git a/db/init/mysql/schema.sql b/db/init/mysql/schema.sql
index 1d413f95a9..f743f8ef5b 100644
--- a/db/init/mysql/schema.sql
+++ b/db/init/mysql/schema.sql
@@ -1782,6 +1782,7 @@ INSERT INTO `shenyu_dict` VALUES ('1529402613195784210', 
'operator', 'OPERATOR',
 INSERT INTO `shenyu_dict` VALUES ('1529402613195784211', 'operator', 
'OPERATOR', 'startsWith', 'startsWith', 'startsWith', 7, 1, '2022-05-25 
18:02:53', '2022-05-25 18:02:53');
 INSERT INTO `shenyu_dict` VALUES ('1529402613195784212', 'operator', 
'OPERATOR', 'endsWith', 'endsWith', 'endsWith', 8, 1, '2022-05-25 18:02:53', 
'2022-05-25 18:02:53');
 INSERT INTO `shenyu_dict` VALUES ('1629402613195884212', 'operator', 
'OPERATOR', 'pathPattern', 'pathPattern', 'pathPattern', 9, 1, '2022-07-19 
18:02:53', '2022-07-19 18:02:53');
+INSERT INTO `shenyu_dict` VALUES ('1629402613195884213', 'operator', 
'OPERATOR', 'isBlank', 'isBlank', 'isBlank', 10, 1, '2023-08-10 11:11:18', 
'2023-08-10 11:11:18');
 INSERT INTO `shenyu_dict` VALUES ('1529402613195784213', 'paramType', 
'PARAM_TYPE', 'post', 'post', 'post', 0, 1, '2022-05-25 18:02:53', '2022-05-25 
18:02:53');
 INSERT INTO `shenyu_dict` VALUES ('1529402613195784214', 'paramType', 
'PARAM_TYPE', 'uri', 'uri', 'uri', 1, 1, '2022-05-25 18:02:53', '2022-05-25 
18:02:53');
 INSERT INTO `shenyu_dict` VALUES ('1529402613195784215', 'paramType', 
'PARAM_TYPE', 'query', 'query', 'query', 2, 1, '2022-05-25 18:02:53', 
'2022-05-25 18:02:53');
diff --git a/db/init/og/create-table.sql b/db/init/og/create-table.sql
index 13d760ac1e..fea2d79ad8 100644
--- a/db/init/og/create-table.sql
+++ b/db/init/og/create-table.sql
@@ -2001,6 +2001,7 @@ INSERT INTO "public"."shenyu_dict" VALUES 
('1529403902796107808', 'operator', 'O
 INSERT INTO "public"."shenyu_dict" VALUES ('1529403902796107809', 'operator', 
'OPERATOR', 'startsWith', 'startsWith', 'startsWith', 7, 1, '2022-05-25 
18:08:02', '2022-05-25 18:08:02');
 INSERT INTO "public"."shenyu_dict" VALUES ('1529403902796107810', 'operator', 
'OPERATOR', 'endsWith', 'endsWith', 'endWiths', 8, 1, '2022-05-25 18:08:02', 
'2022-05-25 18:08:02');
 INSERT INTO "public"."shenyu_dict" VALUES ('1629403902796107810', 'operator', 
'OPERATOR', 'pathPattern', 'pathPattern', 'pathPattern', 9, 1, '2022-07-19 
18:08:02', '2022-07-19 18:08:02');
+INSERT INTO "public"."shenyu_dict" VALUES ('1629403902796107811', 'operator', 
'OPERATOR', 'isBlank', 'isBlank', 'isBlank', 10, 1, '2023-08-10 11:11:18', 
'2023-08-10 11:11:18');
 INSERT INTO "public"."shenyu_dict" VALUES ('1529403902796107811', 'paramType', 
'PARAM_TYPE', 'post', 'post', 'post', 0, 1, '2022-05-25 18:08:02', '2022-05-25 
18:08:02');
 INSERT INTO "public"."shenyu_dict" VALUES ('1529403902796107812', 'paramType', 
'PARAM_TYPE', 'uri', 'uri', 'uri', 1, 1, '2022-05-25 18:08:02', '2022-05-25 
18:08:02');
 INSERT INTO "public"."shenyu_dict" VALUES ('1529403902796107813', 'paramType', 
'PARAM_TYPE', 'query', 'query', 'query', 2, 1, '2022-05-25 18:08:02', 
'2022-05-25 18:08:02');
diff --git a/db/init/oracle/schema.sql b/db/init/oracle/schema.sql
index 22fea3d86a..d071f998a4 100644
--- a/db/init/oracle/schema.sql
+++ b/db/init/oracle/schema.sql
@@ -966,6 +966,9 @@ values ('1518229897206079498', 'operator', 'OPERATOR', 
'exclude', 'exclude', 'ex
 insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(shenyu_dict(type, dict_code, dict_name)) 
*/ into SHENYU_DICT (ID, TYPE, DICT_CODE, DICT_NAME, DICT_VALUE, "desc", SORT, 
ENABLED)
 values ('1618229897206079498', 'operator', 'OPERATOR', 'pathPattern', 
'pathPattern', 'pathPattern', 7, 1);
 
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(shenyu_dict(type, dict_code, dict_name)) 
*/ into SHENYU_DICT (ID, TYPE, DICT_CODE, DICT_NAME, DICT_VALUE, "desc", SORT, 
ENABLED)
+values ('1618229897206079499', 'operator', 'OPERATOR', 'isBlank', 'isBlank', 
'isBlank', 8, 1);
+
 insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(shenyu_dict(type, dict_code, dict_name)) 
*/ into SHENYU_DICT (ID, TYPE, DICT_CODE, DICT_NAME, DICT_VALUE, "desc", SORT, 
ENABLED)
 values ('1518229897206079499', 'paramType', 'PARAM_TYPE', 'post', 'post', 
'post', 0, 1);
 
@@ -2490,4 +2493,4 @@ on column ALTER_TEMPLATE.date_created
   is 'create time';
 comment
 on column ALTER_TEMPLATE.date_updated
-  is 'update time';
\ No newline at end of file
+  is 'update time';
diff --git a/db/init/pg/create-table.sql b/db/init/pg/create-table.sql
index f81b66c1a7..7a60b18e49 100644
--- a/db/init/pg/create-table.sql
+++ b/db/init/pg/create-table.sql
@@ -2000,6 +2000,7 @@ INSERT INTO "public"."shenyu_dict" VALUES 
('1529403902796107808', 'operator', 'O
 INSERT INTO "public"."shenyu_dict" VALUES ('1529403902796107809', 'operator', 
'OPERATOR', 'startsWith', 'startsWith', 'startsWith', 7, 1, '2022-05-25 
18:08:02', '2022-05-25 18:08:02');
 INSERT INTO "public"."shenyu_dict" VALUES ('1529403902796107810', 'operator', 
'OPERATOR', 'endsWith', 'endsWith', 'endWiths', 8, 1, '2022-05-25 18:08:02', 
'2022-05-25 18:08:02');
 INSERT INTO "public"."shenyu_dict" VALUES ('1629403902796107810', 'operator', 
'OPERATOR', 'pathPattern', 'pathPattern', 'pathPattern', 9, 1, '2022-07-19 
18:08:02', '2022-07-19 18:08:02');
+INSERT INTO "public"."shenyu_dict" VALUES ('1629403902796107811', 'operator', 
'OPERATOR', 'isBlank', 'isBlank', 'isBlank', 10, 1, '2023-08-10 11:11:18', 
'2023-08-10 11:11:18');
 INSERT INTO "public"."shenyu_dict" VALUES ('1529403902796107811', 'paramType', 
'PARAM_TYPE', 'post', 'post', 'post', 0, 1, '2022-05-25 18:08:02', '2022-05-25 
18:08:02');
 INSERT INTO "public"."shenyu_dict" VALUES ('1529403902796107812', 'paramType', 
'PARAM_TYPE', 'uri', 'uri', 'uri', 1, 1, '2022-05-25 18:08:02', '2022-05-25 
18:08:02');
 INSERT INTO "public"."shenyu_dict" VALUES ('1529403902796107813', 'paramType', 
'PARAM_TYPE', 'query', 'query', 'query', 2, 1, '2022-05-25 18:08:02', 
'2022-05-25 18:08:02');
diff --git a/db/upgrade/2.6.0-upgrade-2.6.1-mysql.sql 
b/db/upgrade/2.6.0-upgrade-2.6.1-mysql.sql
new file mode 100755
index 0000000000..19c0446058
--- /dev/null
+++ b/db/upgrade/2.6.0-upgrade-2.6.1-mysql.sql
@@ -0,0 +1,19 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements.  See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership.  The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+-- this file works for MySQL.
+
+INSERT INTO `shenyu_dict` VALUES ('1629402613195884213', 'operator', 
'OPERATOR', 'isBlank', 'isBlank', 'isBlank', 10, 1, '2023-08-10 11:11:18', 
'2023-08-10 11:11:18');
diff --git a/db/upgrade/2.6.0-upgrade-2.6.1-og.sql 
b/db/upgrade/2.6.0-upgrade-2.6.1-og.sql
new file mode 100644
index 0000000000..4f6a0e2685
--- /dev/null
+++ b/db/upgrade/2.6.0-upgrade-2.6.1-og.sql
@@ -0,0 +1,19 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements.  See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership.  The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+-- this file works for og.
+
+INSERT INTO "public"."shenyu_dict" VALUES ('1629403902796107811', 'operator', 
'OPERATOR', 'isBlank', 'isBlank', 'isBlank', 10, 1, '2023-08-10 11:11:18', 
'2023-08-10 11:11:18');
diff --git a/db/upgrade/2.6.0-upgrade-2.6.1-oracle.sql 
b/db/upgrade/2.6.0-upgrade-2.6.1-oracle.sql
new file mode 100755
index 0000000000..1c96892b4f
--- /dev/null
+++ b/db/upgrade/2.6.0-upgrade-2.6.1-oracle.sql
@@ -0,0 +1,20 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements.  See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership.  The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+-- this file works for Oracle, can not use "`" syntax.
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(shenyu_dict(type, dict_code, dict_name)) 
*/ into SHENYU_DICT (ID, TYPE, DICT_CODE, DICT_NAME, DICT_VALUE, "desc", SORT, 
ENABLED)
+values ('1618229897206079499', 'operator', 'OPERATOR', 'isBlank', 'isBlank', 
'isBlank', 8, 1);
diff --git a/db/upgrade/2.6.0-upgrade-2.6.1-pg.sql 
b/db/upgrade/2.6.0-upgrade-2.6.1-pg.sql
new file mode 100755
index 0000000000..ceb0afe48e
--- /dev/null
+++ b/db/upgrade/2.6.0-upgrade-2.6.1-pg.sql
@@ -0,0 +1,20 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements.  See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership.  The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+-- this file works for PostgreSQL, can not use "`" syntax.
+
+INSERT INTO "public"."shenyu_dict" VALUES ('1629403902796107811', 'operator', 
'OPERATOR', 'isBlank', 'isBlank', 'isBlank', 10, 1, '2023-08-10 11:11:18', 
'2023-08-10 11:11:18');
+
diff --git a/db/upgrade/upgrade-guide.md b/db/upgrade/upgrade-guide.md
index e7fe7912d8..2fb8115b1b 100644
--- a/db/upgrade/upgrade-guide.md
+++ b/db/upgrade/upgrade-guide.md
@@ -4,6 +4,30 @@
 
 ## To Shenyu Users
 
+- 2.6.0-upgrade-2.6.1-mysql.sql
+
+- 2.6.0-upgrade-2.6.1-oracle.sql
+
+- 2.6.0-upgrade-2.6.1-pg.sql
+
+  > this file is the Shenyu upgrade sql from v2.6.0 to v2.6.1
+
+- 2.5.1-upgrade-2.6.0-mysql.sql
+
+- 2.5.1-upgrade-2.6.0-oracle.sql
+
+- 2.5.1-upgrade-2.6.0-pg.sql
+
+  > this file is the Shenyu upgrade sql from v2.5.1 to v2.6.0
+
+- 2.5.0-upgrade-2.5.1-mysql.sql
+
+- 2.5.0-upgrade-2.5.1-oracle.sql
+
+- 2.5.0-upgrade-2.5.1-pg.sql
+
+  > this file is the Shenyu upgrade sql from v2.5.0 to v2.5.1
+
 - 2.4.3-upgrade-2.5.0-mysql.sql
 
 - 2.4.3-upgrade-2.5.0-pg.sql
diff --git 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/RuleConditionDTO.java
 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/RuleConditionDTO.java
index 4ef2129282..f71b684800 100644
--- 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/RuleConditionDTO.java
+++ 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/RuleConditionDTO.java
@@ -59,7 +59,6 @@ public final class RuleConditionDTO implements Serializable {
     /**
      * parameter value.
      */
-    @NotBlank
     private String paramValue;
 
     public RuleConditionDTO() {
diff --git 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/SelectorService.java
 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/SelectorService.java
index e2af7567a3..79b39e4a7f 100644
--- 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/SelectorService.java
+++ 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/SelectorService.java
@@ -68,7 +68,6 @@ public interface SelectorService extends 
PageService<SelectorQueryCondition, Sel
             selectorDTO.getSelectorConditions().forEach(selectorConditionDTO 
-> {
                 Assert.notBlack(selectorConditionDTO.getParamType(), "if type 
is custom, paramType is not empty");
                 Assert.notBlack(selectorConditionDTO.getParamName(), "if type 
is custom, paramName is not empty");
-                Assert.notBlack(selectorConditionDTO.getParamValue(), "if type 
is custom, paramValue is not empty");
             });
         }
         return StringUtils.isEmpty(selectorDTO.getId()) ? create(selectorDTO) 
: update(selectorDTO);
diff --git a/shenyu-admin/src/main/resources/sql-script/h2/schema.sql 
b/shenyu-admin/src/main/resources/sql-script/h2/schema.sql
index 02d086b324..20d92ffc0b 100755
--- a/shenyu-admin/src/main/resources/sql-script/h2/schema.sql
+++ b/shenyu-admin/src/main/resources/sql-script/h2/schema.sql
@@ -442,6 +442,7 @@ INSERT IGNORE INTO `shenyu_dict` (`id`, `type`,`dict_code`, 
`dict_name`, `dict_v
 INSERT IGNORE INTO `shenyu_dict` (`id`, `type`,`dict_code`, `dict_name`, 
`dict_value`, `desc`, `sort`, `enabled`) VALUES ('1529402613195784211', 
'operator', 'OPERATOR', 'startsWith', 'startsWith', 'startsWith', 7, 1);
 INSERT IGNORE INTO `shenyu_dict` (`id`, `type`,`dict_code`, `dict_name`, 
`dict_value`, `desc`, `sort`, `enabled`) VALUES ('1529402613195784212', 
'operator', 'OPERATOR', 'endsWith', 'endsWith', 'endsWith', 8, 1);
 INSERT IGNORE INTO `shenyu_dict` (`id`, `type`,`dict_code`, `dict_name`, 
`dict_value`, `desc`, `sort`, `enabled`) VALUES ('1629402613195784212', 
'operator', 'OPERATOR', 'pathPattern', 'pathPattern', 'pathPattern', 9, 1);
+INSERT IGNORE INTO `shenyu_dict` (`id`, `type`,`dict_code`, `dict_name`, 
`dict_value`, `desc`, `sort`, `enabled`) VALUES ('1629402613195784213', 
'operator', 'OPERATOR', 'isBlank', 'isBlank', 'isBlank', 10, 1);
 INSERT IGNORE INTO `shenyu_dict` (`id`, `type`,`dict_code`, `dict_name`, 
`dict_value`, `desc`, `sort`, `enabled`) VALUES ('1529402613195784213', 
'paramType', 'PARAM_TYPE', 'post', 'post', 'post', 0, 1);
 INSERT IGNORE INTO `shenyu_dict` (`id`, `type`,`dict_code`, `dict_name`, 
`dict_value`, `desc`, `sort`, `enabled`) VALUES ('1529402613195784214', 
'paramType', 'PARAM_TYPE', 'uri', 'uri', 'uri', 1, 1);
 INSERT IGNORE INTO `shenyu_dict` (`id`, `type`,`dict_code`, `dict_name`, 
`dict_value`, `desc`, `sort`, `enabled`) VALUES ('1529402613195784215', 
'paramType', 'PARAM_TYPE', 'query', 'query', 'query', 2, 1);
diff --git 
a/shenyu-common/src/main/java/org/apache/shenyu/common/enums/OperatorEnum.java 
b/shenyu-common/src/main/java/org/apache/shenyu/common/enums/OperatorEnum.java
index 4a3716ed78..fd0300f08a 100644
--- 
a/shenyu-common/src/main/java/org/apache/shenyu/common/enums/OperatorEnum.java
+++ 
b/shenyu-common/src/main/java/org/apache/shenyu/common/enums/OperatorEnum.java
@@ -80,11 +80,16 @@ public enum OperatorEnum {
      * Time after operator enum.
      */
     TIME_AFTER("TimeAfter", true),
-    
+
     /**
      * Path patter operator enum.
      */
-    PATH_PATTERN("pathPattern", true);
+    PATH_PATTERN("pathPattern", true),
+
+    /**
+     * Is blank operator enum.
+     */
+    IS_BLANK("isBlank", true);
 
     private final String alias;
 
diff --git 
a/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/condition/judge/PredicateJudge.java
 
b/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/condition/judge/BlankPredicateJudge.java
old mode 100644
new mode 100755
similarity index 70%
copy from 
shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/condition/judge/PredicateJudge.java
copy to 
shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/condition/judge/BlankPredicateJudge.java
index 65cf328570..98e44e3431
--- 
a/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/condition/judge/PredicateJudge.java
+++ 
b/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/condition/judge/BlankPredicateJudge.java
@@ -17,22 +17,19 @@
 
 package org.apache.shenyu.plugin.base.condition.judge;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.shenyu.common.dto.ConditionData;
-import org.apache.shenyu.spi.SPI;
+import org.apache.shenyu.spi.Join;
 
 /**
- * Predicate judge.
+ * Blank predicate judge.
  */
-@SPI
-@FunctionalInterface
-public interface PredicateJudge {
+@Join
+public class BlankPredicateJudge implements PredicateJudge {
+
+    @Override
+    public Boolean judge(final ConditionData conditionData, final String 
realData) {
+        return StringUtils.isBlank(realData);
+    }
 
-    /**
-     * judge conditionData and realData is match.
-     *
-     * @param conditionData {@linkplain ConditionData}
-     * @param realData       realData
-     * @return true is pass  false is not pass.
-     */
-    Boolean judge(ConditionData conditionData, String realData);
 }
diff --git 
a/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/condition/judge/PredicateJudge.java
 
b/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/condition/judge/PredicateJudge.java
index 65cf328570..87798640ac 100644
--- 
a/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/condition/judge/PredicateJudge.java
+++ 
b/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/condition/judge/PredicateJudge.java
@@ -35,4 +35,5 @@ public interface PredicateJudge {
      * @return true is pass  false is not pass.
      */
     Boolean judge(ConditionData conditionData, String realData);
+
 }
diff --git 
a/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/condition/judge/PredicateJudgeFactory.java
 
b/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/condition/judge/PredicateJudgeFactory.java
index 5cc3b2c403..d525389b8f 100644
--- 
a/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/condition/judge/PredicateJudgeFactory.java
+++ 
b/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/condition/judge/PredicateJudgeFactory.java
@@ -28,10 +28,10 @@ import java.util.Objects;
  * Predicate judge factory.
  */
 public final class PredicateJudgeFactory {
-    
+
     private PredicateJudgeFactory() {
     }
-    
+
     /**
      * New instance predicate judge.
      *
@@ -41,7 +41,7 @@ public final class PredicateJudgeFactory {
     public static PredicateJudge newInstance(final String operator) {
         return 
ExtensionLoader.getExtensionLoader(PredicateJudge.class).getJoin(processSpecialOperator(operator));
     }
-    
+
     /**
      * judge request realData has by pass.
      *
@@ -50,10 +50,14 @@ public final class PredicateJudgeFactory {
      * @return is true pass   is false not pass
      */
     public static Boolean judge(final ConditionData conditionData, final 
String realData) {
-        if (Objects.isNull(conditionData) || StringUtils.isBlank(realData)) {
+        if (Objects.isNull(conditionData) || 
StringUtils.isBlank(conditionData.getOperator())) {
+            return false;
+        }
+        PredicateJudge predicateJudge = 
newInstance(conditionData.getOperator());
+        if (!(predicateJudge instanceof BlankPredicateJudge) && 
StringUtils.isBlank(realData)) {
             return false;
         }
-        return newInstance(conditionData.getOperator()).judge(conditionData, 
realData);
+        return predicateJudge.judge(conditionData, realData);
     }
 
     /**
diff --git 
a/shenyu-plugin/shenyu-plugin-base/src/main/resources/META-INF/shenyu/org.apache.shenyu.plugin.base.condition.judge.PredicateJudge
 
b/shenyu-plugin/shenyu-plugin-base/src/main/resources/META-INF/shenyu/org.apache.shenyu.plugin.base.condition.judge.PredicateJudge
index 9fd53fbb0e..bc5d60ac78 100644
--- 
a/shenyu-plugin/shenyu-plugin-base/src/main/resources/META-INF/shenyu/org.apache.shenyu.plugin.base.condition.judge.PredicateJudge
+++ 
b/shenyu-plugin/shenyu-plugin-base/src/main/resources/META-INF/shenyu/org.apache.shenyu.plugin.base.condition.judge.PredicateJudge
@@ -25,4 +25,5 @@ 
regex=org.apache.shenyu.plugin.base.condition.judge.RegexPredicateJudge
 
TimeAfter=org.apache.shenyu.plugin.base.condition.judge.TimerAfterPredicateJudge
 
TimeBefore=org.apache.shenyu.plugin.base.condition.judge.TimerBeforePredicateJudge
 exclude=org.apache.shenyu.plugin.base.condition.judge.ExcludePredicateJudge
-pathPattern=org.apache.shenyu.plugin.base.condition.judge.PathPatternPredicateJudge
\ No newline at end of file
+pathPattern=org.apache.shenyu.plugin.base.condition.judge.PathPatternPredicateJudge
+isBlank=org.apache.shenyu.plugin.base.condition.judge.BlankPredicateJudge
diff --git 
a/shenyu-plugin/shenyu-plugin-base/src/test/java/org/apache/shenyu/plugin/base/condition/judge/PredicateJudgeFactoryTest.java
 
b/shenyu-plugin/shenyu-plugin-base/src/test/java/org/apache/shenyu/plugin/base/condition/judge/PredicateJudgeFactoryTest.java
index 74db4f632b..7ba17910c0 100644
--- 
a/shenyu-plugin/shenyu-plugin-base/src/test/java/org/apache/shenyu/plugin/base/condition/judge/PredicateJudgeFactoryTest.java
+++ 
b/shenyu-plugin/shenyu-plugin-base/src/test/java/org/apache/shenyu/plugin/base/condition/judge/PredicateJudgeFactoryTest.java
@@ -76,7 +76,7 @@ public final class PredicateJudgeFactoryTest {
         assertTrue(PredicateJudgeFactory.judge(conditionData, 
"/http/**/test"));
         assertFalse(PredicateJudgeFactory.judge(conditionData, "/http1/**"));
     }
-    
+
     @Test
     public void testPathPatternJudge() {
         conditionData.setOperator(OperatorEnum.PATH_PATTERN.getAlias());
@@ -149,4 +149,12 @@ public final class PredicateJudgeFactoryTest {
         assertFalse(PredicateJudgeFactory.judge(conditionData, 
"/test/http/**"));
         assertFalse(PredicateJudgeFactory.judge(conditionData, "/**/http1/"));
     }
+
+    @Test
+    public void testIsBlankJudge() {
+        conditionData.setOperator(OperatorEnum.IS_BLANK.getAlias());
+        assertTrue(PredicateJudgeFactory.judge(conditionData, null));
+        assertTrue(PredicateJudgeFactory.judge(conditionData, ""));
+        assertFalse(PredicateJudgeFactory.judge(conditionData, "test"));
+    }
 }

Reply via email to