From 9906e5938a25ee14b9871b57d49ef5d9effb0fc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=93=81?= Date: Sat, 12 Dec 2020 12:40:37 +0800 Subject: [PATCH] fix typo, fix #4085 --- .../com/alibaba/druid/wall/WallConfig.java | 22 ++++++++++++++++--- .../com/alibaba/druid/wall/WallVisitor.java | 2 +- .../druid/bvt/filter/wall/WallConfigTest.java | 4 ++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/alibaba/druid/wall/WallConfig.java b/src/main/java/com/alibaba/druid/wall/WallConfig.java index f317674710..017c847c26 100644 --- a/src/main/java/com/alibaba/druid/wall/WallConfig.java +++ b/src/main/java/com/alibaba/druid/wall/WallConfig.java @@ -701,14 +701,30 @@ public class WallConfig implements WallConfigMBean { void filterResultsetTenantColumn(Object value); } - public boolean isSelelctAllow() { + public boolean isSelectAllow() { return selelctAllow; } - public void setSelelctAllow(boolean selelctAllow) { + + public void setSelectAllow(boolean selelctAllow) { this.selelctAllow = selelctAllow; } + /** + * @deprecated use isSelectAllow + */ + public boolean isSelelctAllow() { + return isSelectAllow(); + } + + /** + * @deprecated use setSelelctAllow + */ + public void setSelelctAllow(boolean selelctAllow) { + this.setSelectAllow(selelctAllow); + } + + public boolean isSelectWhereAlwayTrueCheck() { return selectWhereAlwayTrueCheck; } @@ -827,7 +843,7 @@ public class WallConfig implements WallConfigMBean { { Boolean propertyValue = getBoolean(properties, "druid.wall.selelctAllow"); if (propertyValue != null) { - this.setSelelctAllow(propertyValue); + this.setSelectAllow(propertyValue); } } { diff --git a/src/main/java/com/alibaba/druid/wall/WallVisitor.java b/src/main/java/com/alibaba/druid/wall/WallVisitor.java index 69a81c2192..5eace257e2 100644 --- a/src/main/java/com/alibaba/druid/wall/WallVisitor.java +++ b/src/main/java/com/alibaba/druid/wall/WallVisitor.java @@ -149,7 +149,7 @@ public interface WallVisitor extends SQLASTVisitor { @Override default boolean visit(SQLSelectStatement x) { WallConfig config = getConfig(); - if (!config.isSelelctAllow()) { + if (!config.isSelectAllow()) { this.getViolations() .add(new IllegalSQLObjectViolation(ErrorCode.SELECT_NOT_ALLOW, "select not allow", this.toSQL(x))); diff --git a/src/test/java/com/alibaba/druid/bvt/filter/wall/WallConfigTest.java b/src/test/java/com/alibaba/druid/bvt/filter/wall/WallConfigTest.java index 1cbe664088..d6105640d3 100644 --- a/src/test/java/com/alibaba/druid/bvt/filter/wall/WallConfigTest.java +++ b/src/test/java/com/alibaba/druid/bvt/filter/wall/WallConfigTest.java @@ -15,7 +15,7 @@ public class WallConfigTest extends TestCase { WallConfig config = new WallConfig(); config.configFromProperties(properties); - Assert.assertTrue(config.isSelelctAllow()); + Assert.assertTrue(config.isSelectAllow()); } public void test_selectAllow_false() throws Exception { @@ -24,7 +24,7 @@ public class WallConfigTest extends TestCase { WallConfig config = new WallConfig(); config.configFromProperties(properties); - Assert.assertFalse(config.isSelelctAllow()); + Assert.assertFalse(config.isSelectAllow()); } public void test_deleteAllow() throws Exception {