You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/07/20 10:15:58 UTC

[GitHub] [shardingsphere] sunkai-cai opened a new pull request, #19394: add EncryptInsertValuesTokenGeneratorTest

sunkai-cai opened a new pull request, #19394:
URL: https://github.com/apache/shardingsphere/pull/19394

   Fixes #15821 , #15819
   
   Changes proposed in this pull request:
   -  add EncryptInsertValuesTokenGeneratorTest
   -  add EncryptForUseDefaultInsertColumnsTokenGeneratorTest.assertGenerateSQLTokenFromPreviousSQLTokens
   -  fix NPE
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sunkai-cai commented on a diff in pull request #19394: add EncryptInsertValuesTokenGeneratorTest

Posted by GitBox <gi...@apache.org>.
sunkai-cai commented on code in PR #19394:
URL: https://github.com/apache/shardingsphere/pull/19394#discussion_r926194866


##########
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptInsertValuesTokenGenerator.java:
##########
@@ -77,6 +77,9 @@ public InsertValuesToken generateSQLToken(final InsertStatementContext insertSta
     }
     
     private Optional<SQLToken> findPreviousSQLToken(final Class<?> sqlToken) {
+        if (null == previousSQLTokens) {

Review Comment:
   ok, I remove it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sunkai-cai commented on a diff in pull request #19394: add EncryptInsertValuesTokenGeneratorTest

Posted by GitBox <gi...@apache.org>.
sunkai-cai commented on code in PR #19394:
URL: https://github.com/apache/shardingsphere/pull/19394#discussion_r925693561


##########
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptInsertValuesTokenGenerator.java:
##########
@@ -77,6 +77,9 @@ public InsertValuesToken generateSQLToken(final InsertStatementContext insertSta
     }
     
     private Optional<SQLToken> findPreviousSQLToken(final Class<?> sqlToken) {
+        if (null == previousSQLTokens) {

Review Comment:
    I'm not sure previousSQLTokens  must be set in another place



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sunkai-cai commented on a diff in pull request #19394: add EncryptInsertValuesTokenGeneratorTest

Posted by GitBox <gi...@apache.org>.
sunkai-cai commented on code in PR #19394:
URL: https://github.com/apache/shardingsphere/pull/19394#discussion_r925686768


##########
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptInsertValuesTokenGenerator.java:
##########
@@ -77,6 +77,9 @@ public InsertValuesToken generateSQLToken(final InsertStatementContext insertSta
     }
     
     private Optional<SQLToken> findPreviousSQLToken(final Class<?> sqlToken) {
+        if (null == previousSQLTokens) {

Review Comment:
   a NPE when previousSQLTokens is null



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sunkai-cai commented on a diff in pull request #19394: add EncryptInsertValuesTokenGeneratorTest

Posted by GitBox <gi...@apache.org>.
sunkai-cai commented on code in PR #19394:
URL: https://github.com/apache/shardingsphere/pull/19394#discussion_r925691861


##########
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptInsertValuesTokenGenerator.java:
##########
@@ -77,6 +77,9 @@ public InsertValuesToken generateSQLToken(final InsertStatementContext insertSta
     }
     
     private Optional<SQLToken> findPreviousSQLToken(final Class<?> sqlToken) {
+        if (null == previousSQLTokens) {

Review Comment:
   EncryptInsertValuesTokenGenerator need to setPreviousSQLTokens , if not previousSQLTokens will be null.  



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] codecov-commenter commented on pull request #19394: add EncryptInsertValuesTokenGeneratorTest

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #19394:
URL: https://github.com/apache/shardingsphere/pull/19394#issuecomment-1190150352

   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/19394?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#19394](https://codecov.io/gh/apache/shardingsphere/pull/19394?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0a688e9) into [master](https://codecov.io/gh/apache/shardingsphere/commit/3620a24aa52afff115eae765020fb51be556a46e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (3620a24) will **increase** coverage by `0.20%`.
   > The diff coverage is `57.14%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #19394      +/-   ##
   ============================================
   + Coverage     59.63%   59.83%   +0.20%     
   - Complexity     2373     2378       +5     
   ============================================
     Files          3818     3821       +3     
     Lines         54367    54398      +31     
     Branches       7628     7632       +4     
   ============================================
   + Hits          32420    32551     +131     
   + Misses        19147    19032     -115     
   - Partials       2800     2815      +15     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/19394?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ral/queryable/ConvertYamlConfigurationHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/19394/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmFsL3F1ZXJ5YWJsZS9Db252ZXJ0WWFtbENvbmZpZ3VyYXRpb25IYW5kbGVyLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...cryptForUseDefaultInsertColumnsTokenGenerator.java](https://codecov.io/gh/apache/shardingsphere/pull/19394/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtZW5jcnlwdC9zaGFyZGluZ3NwaGVyZS1lbmNyeXB0LWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2VuY3J5cHQvcmV3cml0ZS90b2tlbi9nZW5lcmF0b3IvRW5jcnlwdEZvclVzZURlZmF1bHRJbnNlcnRDb2x1bW5zVG9rZW5HZW5lcmF0b3IuamF2YQ==) | `70.45% <100.00%> (+68.07%)` | :arrow_up: |
   | [...n/generator/EncryptInsertValuesTokenGenerator.java](https://codecov.io/gh/apache/shardingsphere/pull/19394/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtZW5jcnlwdC9zaGFyZGluZ3NwaGVyZS1lbmNyeXB0LWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2VuY3J5cHQvcmV3cml0ZS90b2tlbi9nZW5lcmF0b3IvRW5jcnlwdEluc2VydFZhbHVlc1Rva2VuR2VuZXJhdG9yLmphdmE=) | `84.14% <100.00%> (+82.89%)` | :arrow_up: |
   | [...re/driver/api/ShardingSphereDataSourceFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/19394/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtamRiYy9zaGFyZGluZ3NwaGVyZS1qZGJjLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RyaXZlci9hcGkvU2hhcmRpbmdTcGhlcmVEYXRhU291cmNlRmFjdG9yeS5qYXZh) | `54.54% <0.00%> (-45.46%)` | :arrow_down: |
   | [...nd/text/distsql/ral/hint/enums/HintSourceType.java](https://codecov.io/gh/apache/shardingsphere/pull/19394/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmFsL2hpbnQvZW51bXMvSGludFNvdXJjZVR5cGUuamF2YQ==) | `0.00% <0.00%> (-42.86%)` | :arrow_down: |
   | [...dl/impl/ShardingCreateIndexStatementValidator.java](https://codecov.io/gh/apache/shardingsphere/pull/19394/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcm91dGUvZW5naW5lL3ZhbGlkYXRvci9kZGwvaW1wbC9TaGFyZGluZ0NyZWF0ZUluZGV4U3RhdGVtZW50VmFsaWRhdG9yLmphdmE=) | `76.92% <0.00%> (-13.99%)` | :arrow_down: |
   | [...e/schema/decorator/model/ShardingSphereSchema.java](https://codecov.io/gh/apache/shardingsphere/pull/19394/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9kYXRhYmFzZS9zY2hlbWEvZGVjb3JhdG9yL21vZGVsL1NoYXJkaW5nU3BoZXJlU2NoZW1hLmphdmE=) | `71.42% <0.00%> (-3.58%)` | :arrow_down: |
   | [...r/sql/common/segment/dml/column/ColumnSegment.java](https://codecov.io/gh/apache/shardingsphere/pull/19394/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvY29tbW9uL3NlZ21lbnQvZG1sL2NvbHVtbi9Db2x1bW5TZWdtZW50LmphdmE=) | `37.50% <0.00%> (-2.50%)` | :arrow_down: |
   | [...he/shardingsphere/mode/manager/ContextManager.java](https://codecov.io/gh/apache/shardingsphere/pull/19394/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtbW9kZS9zaGFyZGluZ3NwaGVyZS1tb2RlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL21vZGUvbWFuYWdlci9Db250ZXh0TWFuYWdlci5qYXZh) | `68.85% <0.00%> (-0.21%)` | :arrow_down: |
   | [...l/parser/core/database/visitor/SQLVisitorRule.java](https://codecov.io/gh/apache/shardingsphere/pull/19394/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWVuZ2luZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9jb3JlL2RhdGFiYXNlL3Zpc2l0b3IvU1FMVmlzaXRvclJ1bGUuamF2YQ==) | `100.00% <0.00%> (ø)` | |
   | ... and [19 more](https://codecov.io/gh/apache/shardingsphere/pull/19394/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN commented on a diff in pull request #19394: add EncryptInsertValuesTokenGeneratorTest

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on code in PR #19394:
URL: https://github.com/apache/shardingsphere/pull/19394#discussion_r925676647


##########
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptInsertValuesTokenGenerator.java:
##########
@@ -77,6 +77,9 @@ public InsertValuesToken generateSQLToken(final InsertStatementContext insertSta
     }
     
     private Optional<SQLToken> findPreviousSQLToken(final Class<?> sqlToken) {
+        if (null == previousSQLTokens) {

Review Comment:
   Why change the production code?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN commented on a diff in pull request #19394: add EncryptInsertValuesTokenGeneratorTest

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on code in PR #19394:
URL: https://github.com/apache/shardingsphere/pull/19394#discussion_r927237940


##########
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptGeneratorBaseTest.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ */
+
+package org.apache.shardingsphere.encrypt.rewrite.token.generator;
+
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
+import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
+import org.apache.shardingsphere.encrypt.api.config.rule.EncryptColumnRuleConfiguration;
+import org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfiguration;
+import org.apache.shardingsphere.encrypt.rewrite.token.pojo.EncryptInsertValuesToken;
+import org.apache.shardingsphere.infra.binder.statement.dml.InsertStatementContext;
+import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
+import org.apache.shardingsphere.infra.database.DefaultDatabase;
+import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
+import org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.SQLToken;
+import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.generic.InsertValue;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.assignment.InsertValuesSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.ColumnSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.InsertColumnsSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.ParameterMarkerExpressionSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.TableNameSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.InsertStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLInsertStatement;
+
+public abstract class EncryptGeneratorBaseTest {
+    
+    protected static EncryptRuleConfiguration createEncryptRuleConfiguration() {
+        EncryptColumnRuleConfiguration pwdColumnConfig = new EncryptColumnRuleConfiguration("pwd", "pwd_cipher", "pwd_assist", "pwd_plain", "test_encryptor", "test_encryptor", false);
+        return new EncryptRuleConfiguration(Collections.singleton(new EncryptTableRuleConfiguration("tbl", Collections.singletonList(pwdColumnConfig), null)),
+                Collections.singletonMap("test_encryptor", new ShardingSphereAlgorithmConfiguration("CORE.QUERY_ASSISTED.FIXTURE", new Properties())));
+    }
+    
+    protected static InsertStatementContext createInsertStatementContext(final List<Object> parameters) {
+        InsertStatement insertStatement = createInsertStatement();
+        ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
+        ShardingSphereSchema schema = mock(ShardingSphereSchema.class);
+        when(database.getSchemas().get(DefaultDatabase.LOGIC_NAME)).thenReturn(schema);
+        when(schema.getAllColumnNames("tbl")).thenReturn(Arrays.asList("id", "name", "status", "pwd"));
+        return new InsertStatementContext(Collections.singletonMap(DefaultDatabase.LOGIC_NAME, database), parameters, insertStatement, DefaultDatabase.LOGIC_NAME);
+    }
+    
+    protected static InsertStatement createInsertStatement() {
+        InsertStatement result = new MySQLInsertStatement();
+        result.setTable(new SimpleTableSegment(new TableNameSegment(0, 0, new IdentifierValue("tbl"))));
+        InsertColumnsSegment insertColumnsSegment = new InsertColumnsSegment(0, 0, Arrays.asList(
+                new ColumnSegment(0, 0, new IdentifierValue("id")), new ColumnSegment(0, 0, new IdentifierValue("name")),
+                new ColumnSegment(0, 0, new IdentifierValue("status")), new ColumnSegment(0, 0, new IdentifierValue("pwd"))));
+        result.setInsertColumns(insertColumnsSegment);
+        result.getValues().add(new InsertValuesSegment(0, 0, createValueExpressions()));
+        return result;
+    }
+
+    private static List<ExpressionSegment> createValueExpressions() {
+        List<ExpressionSegment> result = new ArrayList<>(4);
+        result.add(new ParameterMarkerExpressionSegment(0, 0, 1));
+        result.add(new ParameterMarkerExpressionSegment(0, 0, 2));
+        result.add(new ParameterMarkerExpressionSegment(0, 0, 3));
+        result.add(new ParameterMarkerExpressionSegment(0, 0, 4));
+        return result;
+    }
+    
+    protected static List<SQLToken> getPreviousSQLTokens() {
+        List<SQLToken> result = new ArrayList<>(2);

Review Comment:
   Why the size is 2 here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN commented on a diff in pull request #19394: add EncryptInsertValuesTokenGeneratorTest

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on code in PR #19394:
URL: https://github.com/apache/shardingsphere/pull/19394#discussion_r926156730


##########
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptInsertValuesTokenGenerator.java:
##########
@@ -77,6 +77,9 @@ public InsertValuesToken generateSQLToken(final InsertStatementContext insertSta
     }
     
     private Optional<SQLToken> findPreviousSQLToken(final Class<?> sqlToken) {
+        if (null == previousSQLTokens) {

Review Comment:
   > a NPE when previousSQLTokens is null
   
   previousSQLTokens is Collection, null value is not allowed for a Collection in ShardingSphere's code style.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN merged pull request #19394: add EncryptInsertValuesTokenGeneratorTest

Posted by GitBox <gi...@apache.org>.
TeslaCN merged PR #19394:
URL: https://github.com/apache/shardingsphere/pull/19394


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org