You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "rickchengx (via GitHub)" <gi...@apache.org> on 2023/06/12 08:45:47 UTC

[GitHub] [dolphinscheduler] rickchengx opened a new pull request, #14332: [Improvement-14331][common] Remove the duplicate ParameterUtils

rickchengx opened a new pull request, #14332:
URL: https://github.com/apache/dolphinscheduler/pull/14332

   <!--Thanks very much for contributing to Apache DolphinScheduler, we are happy that you want to help us improve DolphinScheduler! -->
   
   ## Purpose of the pull request
   
   * close: #14331 
   
   <!--(For example: This pull request adds checkstyle plugin).-->
   
   ## Brief change log
   
   Remove the duplicate ParameterUtils
   
   <!--*(for example:)*
   - *Add maven-checkstyle-plugin to root pom.xml*
   -->
   
   ## Verify this pull request
   
   <!--*(Please pick either of the following options)*-->
   
   This pull request is code cleanup without any test coverage.
   
   *(or)*
   
   This pull request is already covered by existing tests, such as *(please describe tests)*.
   
   (or)
   
   This change added tests and can be verified as follows:
   
   <!--*(example:)*
   - *Added dolphinscheduler-dao tests for end-to-end.*
   - *Added CronUtilsTest to verify the change.*
   - *Manually verified the change by testing locally.* -->
   
   (or)
   
   If your pull request contain incompatible change, you should also add it to `docs/docs/en/guide/upgrede/incompatible.md`
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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


[GitHub] [dolphinscheduler] rickchengx commented on a diff in pull request #14332: [Improvement-14331][common] Remove the duplicate ParameterUtils

Posted by "rickchengx (via GitHub)" <gi...@apache.org>.
rickchengx commented on code in PR #14332:
URL: https://github.com/apache/dolphinscheduler/pull/14332#discussion_r1226430620


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/ParameterUtils.java:
##########
@@ -1,133 +0,0 @@
-/*
- * 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.dolphinscheduler.plugin.task.api.utils;
-
-import org.apache.dolphinscheduler.common.constants.DateConstants;
-import org.apache.dolphinscheduler.common.utils.DateUtils;
-import org.apache.dolphinscheduler.plugin.task.api.model.Property;
-import org.apache.dolphinscheduler.plugin.task.api.parser.PlaceholderUtils;
-import org.apache.dolphinscheduler.plugin.task.api.parser.TimePlaceholderUtils;
-
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * parameter parse utils
- */
-public class ParameterUtils {

Review Comment:
   Hi, @ruanwenjun , thanks for you comment
   
   There are 2 `ParameterUtils` and a `ParamUtils` under `task-api` module, and there are many common methods in these 3 classes, such as `convert()`, `dateTemplateParse()`, `convertParameterPlaceholders()`
   
   I think they should be unified in one utils class (which package to put this class in can be discussed), WDYT
   
   Currently, the merged utils class is put in `org.apache.dolphinscheduler.plugin.task.api.parser`, do u think it should be put elsewhere or  there is a reason that it must be split into multiple utils classes



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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


[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #14332: [Improvement-14331][common] Remove the duplicate ParameterUtils

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14332:
URL: https://github.com/apache/dolphinscheduler/pull/14332#issuecomment-1588664652

   SonarCloud Quality Gate failed.&nbsp; &nbsp; [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=14332)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=CODE_SMELL)
   
   [![37.5%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/25-16px.png '37.5%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14332&metric=new_coverage&view=list) [37.5% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14332&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14332&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14332&metric=new_duplicated_lines_density&view=list)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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


[GitHub] [dolphinscheduler] codecov-commenter commented on pull request #14332: [Improvement-14331][common] Remove the duplicate ParameterUtils

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #14332:
URL: https://github.com/apache/dolphinscheduler/pull/14332#issuecomment-1586916350

   ## [Codecov](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14332?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   > Merging [#14332](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14332?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (f6cbc61) into [dev](https://app.codecov.io/gh/apache/dolphinscheduler/commit/1c935d901e09eab6c76375c170745c7e6ce6af14?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (1c935d9) will **decrease** coverage by `0.03%`.
   > The diff coverage is `55.55%`.
   
   > :exclamation: Current head f6cbc61 differs from pull request most recent head 9d588e6. Consider uploading reports for the commit 9d588e6 to get more accurate results
   
   ```diff
   @@             Coverage Diff              @@
   ##                dev   #14332      +/-   ##
   ============================================
   - Coverage     38.54%   38.51%   -0.03%     
   + Complexity     4568     4555      -13     
   ============================================
     Files          1241     1239       -2     
     Lines         43557    43465      -92     
     Branches       4812     4774      -38     
   ============================================
   - Hits          16789    16742      -47     
   + Misses        24907    24874      -33     
   + Partials       1861     1849      -12     
   ```
   
   
   | [Impacted Files](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14332?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [...cheduler/api/controller/AccessTokenController.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14332?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL2NvbnRyb2xsZXIvQWNjZXNzVG9rZW5Db250cm9sbGVyLmphdmE=) | `87.50% <ø> (ø)` | |
   | [...scheduler/api/controller/AlertGroupController.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14332?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL2NvbnRyb2xsZXIvQWxlcnRHcm91cENvbnRyb2xsZXIuamF2YQ==) | `78.57% <ø> (ø)` | |
   | [.../api/controller/AlertPluginInstanceController.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14332?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL2NvbnRyb2xsZXIvQWxlcnRQbHVnaW5JbnN0YW5jZUNvbnRyb2xsZXIuamF2YQ==) | `100.00% <ø> (ø)` | |
   | [...hinscheduler/api/controller/ClusterController.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14332?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL2NvbnRyb2xsZXIvQ2x1c3RlckNvbnRyb2xsZXIuamF2YQ==) | `89.47% <ø> (ø)` | |
   | [...cheduler/api/controller/DataQualityController.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14332?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL2NvbnRyb2xsZXIvRGF0YVF1YWxpdHlDb250cm9sbGVyLmphdmE=) | `64.70% <ø> (ø)` | |
   | [...scheduler/api/controller/DataSourceController.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14332?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL2NvbnRyb2xsZXIvRGF0YVNvdXJjZUNvbnRyb2xsZXIuamF2YQ==) | `38.70% <ø> (ø)` | |
   | [...cheduler/api/controller/EnvironmentController.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14332?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL2NvbnRyb2xsZXIvRW52aXJvbm1lbnRDb250cm9sbGVyLmphdmE=) | `90.47% <ø> (ø)` | |
   | [...heduler/api/controller/K8sNamespaceController.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14332?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL2NvbnRyb2xsZXIvSzhzTmFtZXNwYWNlQ29udHJvbGxlci5qYXZh) | `81.81% <ø> (ø)` | |
   | [...er/api/controller/ProcessDefinitionController.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14332?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL2NvbnRyb2xsZXIvUHJvY2Vzc0RlZmluaXRpb25Db250cm9sbGVyLmphdmE=) | `58.62% <ø> (ø)` | |
   | [...uler/api/controller/ProcessInstanceController.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14332?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL2NvbnRyb2xsZXIvUHJvY2Vzc0luc3RhbmNlQ29udHJvbGxlci5qYXZh) | `65.30% <ø> (ø)` | |
   | ... and [39 more](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14332?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | |
   
   ... and [33 files with indirect coverage changes](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14332/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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


[GitHub] [dolphinscheduler] rickchengx commented on a diff in pull request #14332: [Improvement-14331][common] Remove the duplicate ParameterUtils

Posted by "rickchengx (via GitHub)" <gi...@apache.org>.
rickchengx commented on code in PR #14332:
URL: https://github.com/apache/dolphinscheduler/pull/14332#discussion_r1226430620


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/ParameterUtils.java:
##########
@@ -1,133 +0,0 @@
-/*
- * 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.dolphinscheduler.plugin.task.api.utils;
-
-import org.apache.dolphinscheduler.common.constants.DateConstants;
-import org.apache.dolphinscheduler.common.utils.DateUtils;
-import org.apache.dolphinscheduler.plugin.task.api.model.Property;
-import org.apache.dolphinscheduler.plugin.task.api.parser.PlaceholderUtils;
-import org.apache.dolphinscheduler.plugin.task.api.parser.TimePlaceholderUtils;
-
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * parameter parse utils
- */
-public class ParameterUtils {

Review Comment:
   Hi, @ruanwenjun , thanks for you comment
   
   There are 2 `ParameterUtils` and a `ParamUtils` under `task-api` module, and there are many common methods in there 3 classes, such as `convert()`, `dateTemplateParse()`, `convertParameterPlaceholders()`
   
   I think they should be unified in one utils class (which package to put this class in can be discussed), WDYT



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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


[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #14332: [Improvement-14331][common] Remove the duplicate ParameterUtils

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14332:
URL: https://github.com/apache/dolphinscheduler/pull/14332#issuecomment-1588658294

   SonarCloud Quality Gate failed.&nbsp; &nbsp; [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=14332)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=CODE_SMELL) [22 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=CODE_SMELL)
   
   [![37.5%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/25-16px.png '37.5%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14332&metric=new_coverage&view=list) [37.5% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14332&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14332&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14332&metric=new_duplicated_lines_density&view=list)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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


[GitHub] [dolphinscheduler] github-code-scanning[bot] commented on a diff in pull request #14332: [Improvement-14331][common] Remove the duplicate ParameterUtils

Posted by "github-code-scanning[bot] (via GitHub)" <gi...@apache.org>.
github-code-scanning[bot] commented on code in PR #14332:
URL: https://github.com/apache/dolphinscheduler/pull/14332#discussion_r1227615739


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/ParameterUtils.java:
##########
@@ -76,29 +87,198 @@
     }
 
     /**
-     * handle escapes
+     * new
+     * convert parameters place holders
      *
-     * @param inputString input string
-     * @return string filter escapes
+     * @param parameterString parameter
+     * @param parameterMap    parameter map
+     * @return convert parameters place holders
      */
-    public static String handleEscapes(String inputString) {
+    public static String convertParameterPlaceholders2(String parameterString, Map<String, String> parameterMap) {
+        if (StringUtils.isEmpty(parameterString)) {
+            return parameterString;
+        }
+        // Get current time, schedule execute time
+        String cronTimeStr = parameterMap.get(PARAMETER_SHECDULE_TIME);
+        Date cronTime = null;
 
-        if (!StringUtils.isEmpty(inputString)) {
-            return inputString.replace("%", "////%").replaceAll("[\n|\r\t]", "_");
+        if (StringUtils.isNotEmpty(cronTimeStr)) {
+            cronTime = DateUtils.parse(cronTimeStr, PARAMETER_FORMAT_TIME);
+
+        } else {
+            cronTime = new Date();
         }
-        return inputString;
+
+        // replace variable ${} form,refers to the replacement of system variables and custom variables
+        if (!parameterMap.isEmpty()) {
+            parameterString = PlaceholderUtils.replacePlaceholders(parameterString, parameterMap, true);
+        }
+
+        // replace time $[...] form, eg. $[yyyyMMdd]
+        if (cronTime != null) {
+            return dateTemplateParse(parameterString, cronTime);
+        }
+        return parameterString;
+    }
+
+    /**
+     * set in parameter
+     *
+     * @param index    index
+     * @param stmt     preparedstatement
+     * @param dataType data type
+     * @param value    value
+     * @throws Exception errors
+     */
+    public static void setInParameter(int index, PreparedStatement stmt, DataType dataType,
+                                      String value) throws Exception {
+        if (dataType.equals(DataType.VARCHAR)) {
+            stmt.setString(index, value);
+        } else if (dataType.equals(DataType.INTEGER)) {
+            stmt.setInt(index, Integer.parseInt(value));
+        } else if (dataType.equals(DataType.LONG)) {
+            stmt.setLong(index, Long.parseLong(value));
+        } else if (dataType.equals(DataType.FLOAT)) {
+            stmt.setFloat(index, Float.parseFloat(value));
+        } else if (dataType.equals(DataType.DOUBLE)) {
+            stmt.setDouble(index, Double.parseDouble(value));
+        } else if (dataType.equals(DataType.DATE)) {
+            stmt.setDate(index, java.sql.Date.valueOf(value));
+        } else if (dataType.equals(DataType.TIME)) {
+            stmt.setString(index, value);
+        } else if (dataType.equals(DataType.TIMESTAMP)) {
+            stmt.setTimestamp(index, java.sql.Timestamp.valueOf(value));
+        } else if (dataType.equals(DataType.BOOLEAN)) {
+            stmt.setBoolean(index, Boolean.parseBoolean(value));
+        }
+    }
+
+    public static Serializable getParameterValue(Property property) {
+        if (property == null) {
+            return null;
+        }
+        String value = property.getValue();
+        switch (property.getType()) {
+            case LONG:
+                return Long.valueOf(value);
+            case FLOAT:
+                return Float.valueOf(value);

Review Comment:
   ## Missing catch of NumberFormatException
   
   Potential uncaught 'java.lang.NumberFormatException'.
   
   [Show more details](https://github.com/apache/dolphinscheduler/security/code-scanning/2962)



##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/ParameterUtils.java:
##########
@@ -76,29 +87,198 @@
     }
 
     /**
-     * handle escapes
+     * new
+     * convert parameters place holders
      *
-     * @param inputString input string
-     * @return string filter escapes
+     * @param parameterString parameter
+     * @param parameterMap    parameter map
+     * @return convert parameters place holders
      */
-    public static String handleEscapes(String inputString) {
+    public static String convertParameterPlaceholders2(String parameterString, Map<String, String> parameterMap) {
+        if (StringUtils.isEmpty(parameterString)) {
+            return parameterString;
+        }
+        // Get current time, schedule execute time
+        String cronTimeStr = parameterMap.get(PARAMETER_SHECDULE_TIME);
+        Date cronTime = null;
 
-        if (!StringUtils.isEmpty(inputString)) {
-            return inputString.replace("%", "////%").replaceAll("[\n|\r\t]", "_");
+        if (StringUtils.isNotEmpty(cronTimeStr)) {
+            cronTime = DateUtils.parse(cronTimeStr, PARAMETER_FORMAT_TIME);
+
+        } else {
+            cronTime = new Date();
         }
-        return inputString;
+
+        // replace variable ${} form,refers to the replacement of system variables and custom variables
+        if (!parameterMap.isEmpty()) {
+            parameterString = PlaceholderUtils.replacePlaceholders(parameterString, parameterMap, true);
+        }
+
+        // replace time $[...] form, eg. $[yyyyMMdd]
+        if (cronTime != null) {
+            return dateTemplateParse(parameterString, cronTime);
+        }
+        return parameterString;
+    }
+
+    /**
+     * set in parameter
+     *
+     * @param index    index
+     * @param stmt     preparedstatement
+     * @param dataType data type
+     * @param value    value
+     * @throws Exception errors
+     */
+    public static void setInParameter(int index, PreparedStatement stmt, DataType dataType,
+                                      String value) throws Exception {
+        if (dataType.equals(DataType.VARCHAR)) {
+            stmt.setString(index, value);
+        } else if (dataType.equals(DataType.INTEGER)) {
+            stmt.setInt(index, Integer.parseInt(value));
+        } else if (dataType.equals(DataType.LONG)) {
+            stmt.setLong(index, Long.parseLong(value));
+        } else if (dataType.equals(DataType.FLOAT)) {
+            stmt.setFloat(index, Float.parseFloat(value));
+        } else if (dataType.equals(DataType.DOUBLE)) {
+            stmt.setDouble(index, Double.parseDouble(value));
+        } else if (dataType.equals(DataType.DATE)) {
+            stmt.setDate(index, java.sql.Date.valueOf(value));
+        } else if (dataType.equals(DataType.TIME)) {
+            stmt.setString(index, value);
+        } else if (dataType.equals(DataType.TIMESTAMP)) {
+            stmt.setTimestamp(index, java.sql.Timestamp.valueOf(value));
+        } else if (dataType.equals(DataType.BOOLEAN)) {
+            stmt.setBoolean(index, Boolean.parseBoolean(value));
+        }
+    }
+
+    public static Serializable getParameterValue(Property property) {
+        if (property == null) {
+            return null;
+        }
+        String value = property.getValue();
+        switch (property.getType()) {
+            case LONG:
+                return Long.valueOf(value);

Review Comment:
   ## Missing catch of NumberFormatException
   
   Potential uncaught 'java.lang.NumberFormatException'.
   
   [Show more details](https://github.com/apache/dolphinscheduler/security/code-scanning/2961)



##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/ParameterUtils.java:
##########
@@ -76,29 +87,198 @@
     }
 
     /**
-     * handle escapes
+     * new
+     * convert parameters place holders
      *
-     * @param inputString input string
-     * @return string filter escapes
+     * @param parameterString parameter
+     * @param parameterMap    parameter map
+     * @return convert parameters place holders
      */
-    public static String handleEscapes(String inputString) {
+    public static String convertParameterPlaceholders2(String parameterString, Map<String, String> parameterMap) {
+        if (StringUtils.isEmpty(parameterString)) {
+            return parameterString;
+        }
+        // Get current time, schedule execute time
+        String cronTimeStr = parameterMap.get(PARAMETER_SHECDULE_TIME);
+        Date cronTime = null;
 
-        if (!StringUtils.isEmpty(inputString)) {
-            return inputString.replace("%", "////%").replaceAll("[\n|\r\t]", "_");
+        if (StringUtils.isNotEmpty(cronTimeStr)) {
+            cronTime = DateUtils.parse(cronTimeStr, PARAMETER_FORMAT_TIME);
+
+        } else {
+            cronTime = new Date();
         }
-        return inputString;
+
+        // replace variable ${} form,refers to the replacement of system variables and custom variables
+        if (!parameterMap.isEmpty()) {
+            parameterString = PlaceholderUtils.replacePlaceholders(parameterString, parameterMap, true);
+        }
+
+        // replace time $[...] form, eg. $[yyyyMMdd]
+        if (cronTime != null) {
+            return dateTemplateParse(parameterString, cronTime);
+        }
+        return parameterString;
+    }
+
+    /**
+     * set in parameter
+     *
+     * @param index    index
+     * @param stmt     preparedstatement
+     * @param dataType data type
+     * @param value    value
+     * @throws Exception errors
+     */
+    public static void setInParameter(int index, PreparedStatement stmt, DataType dataType,
+                                      String value) throws Exception {
+        if (dataType.equals(DataType.VARCHAR)) {
+            stmt.setString(index, value);
+        } else if (dataType.equals(DataType.INTEGER)) {
+            stmt.setInt(index, Integer.parseInt(value));
+        } else if (dataType.equals(DataType.LONG)) {
+            stmt.setLong(index, Long.parseLong(value));
+        } else if (dataType.equals(DataType.FLOAT)) {
+            stmt.setFloat(index, Float.parseFloat(value));
+        } else if (dataType.equals(DataType.DOUBLE)) {
+            stmt.setDouble(index, Double.parseDouble(value));
+        } else if (dataType.equals(DataType.DATE)) {
+            stmt.setDate(index, java.sql.Date.valueOf(value));
+        } else if (dataType.equals(DataType.TIME)) {
+            stmt.setString(index, value);
+        } else if (dataType.equals(DataType.TIMESTAMP)) {
+            stmt.setTimestamp(index, java.sql.Timestamp.valueOf(value));
+        } else if (dataType.equals(DataType.BOOLEAN)) {
+            stmt.setBoolean(index, Boolean.parseBoolean(value));
+        }
+    }
+
+    public static Serializable getParameterValue(Property property) {
+        if (property == null) {
+            return null;
+        }
+        String value = property.getValue();
+        switch (property.getType()) {
+            case LONG:
+                return Long.valueOf(value);
+            case FLOAT:
+                return Float.valueOf(value);
+            case INTEGER:
+                return Integer.valueOf(value);
+            case DOUBLE:
+                return Double.valueOf(value);

Review Comment:
   ## Missing catch of NumberFormatException
   
   Potential uncaught 'java.lang.NumberFormatException'.
   
   [Show more details](https://github.com/apache/dolphinscheduler/security/code-scanning/2964)



##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/ParameterUtils.java:
##########
@@ -76,29 +87,198 @@
     }
 
     /**
-     * handle escapes
+     * new
+     * convert parameters place holders
      *
-     * @param inputString input string
-     * @return string filter escapes
+     * @param parameterString parameter
+     * @param parameterMap    parameter map
+     * @return convert parameters place holders
      */
-    public static String handleEscapes(String inputString) {
+    public static String convertParameterPlaceholders2(String parameterString, Map<String, String> parameterMap) {
+        if (StringUtils.isEmpty(parameterString)) {
+            return parameterString;
+        }
+        // Get current time, schedule execute time
+        String cronTimeStr = parameterMap.get(PARAMETER_SHECDULE_TIME);
+        Date cronTime = null;
 
-        if (!StringUtils.isEmpty(inputString)) {
-            return inputString.replace("%", "////%").replaceAll("[\n|\r\t]", "_");
+        if (StringUtils.isNotEmpty(cronTimeStr)) {
+            cronTime = DateUtils.parse(cronTimeStr, PARAMETER_FORMAT_TIME);
+
+        } else {
+            cronTime = new Date();
         }
-        return inputString;
+
+        // replace variable ${} form,refers to the replacement of system variables and custom variables
+        if (!parameterMap.isEmpty()) {
+            parameterString = PlaceholderUtils.replacePlaceholders(parameterString, parameterMap, true);
+        }
+
+        // replace time $[...] form, eg. $[yyyyMMdd]
+        if (cronTime != null) {
+            return dateTemplateParse(parameterString, cronTime);
+        }
+        return parameterString;
+    }
+
+    /**
+     * set in parameter
+     *
+     * @param index    index
+     * @param stmt     preparedstatement
+     * @param dataType data type
+     * @param value    value
+     * @throws Exception errors
+     */
+    public static void setInParameter(int index, PreparedStatement stmt, DataType dataType,
+                                      String value) throws Exception {
+        if (dataType.equals(DataType.VARCHAR)) {
+            stmt.setString(index, value);
+        } else if (dataType.equals(DataType.INTEGER)) {
+            stmt.setInt(index, Integer.parseInt(value));
+        } else if (dataType.equals(DataType.LONG)) {
+            stmt.setLong(index, Long.parseLong(value));
+        } else if (dataType.equals(DataType.FLOAT)) {
+            stmt.setFloat(index, Float.parseFloat(value));
+        } else if (dataType.equals(DataType.DOUBLE)) {
+            stmt.setDouble(index, Double.parseDouble(value));
+        } else if (dataType.equals(DataType.DATE)) {
+            stmt.setDate(index, java.sql.Date.valueOf(value));
+        } else if (dataType.equals(DataType.TIME)) {
+            stmt.setString(index, value);
+        } else if (dataType.equals(DataType.TIMESTAMP)) {
+            stmt.setTimestamp(index, java.sql.Timestamp.valueOf(value));
+        } else if (dataType.equals(DataType.BOOLEAN)) {
+            stmt.setBoolean(index, Boolean.parseBoolean(value));
+        }
+    }
+
+    public static Serializable getParameterValue(Property property) {
+        if (property == null) {
+            return null;
+        }
+        String value = property.getValue();
+        switch (property.getType()) {
+            case LONG:
+                return Long.valueOf(value);
+            case FLOAT:
+                return Float.valueOf(value);
+            case INTEGER:
+                return Integer.valueOf(value);

Review Comment:
   ## Missing catch of NumberFormatException
   
   Potential uncaught 'java.lang.NumberFormatException'.
   
   [Show more details](https://github.com/apache/dolphinscheduler/security/code-scanning/2963)



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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


[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #14332: [Improvement-14331][common] Remove the duplicate ParameterUtils

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14332:
URL: https://github.com/apache/dolphinscheduler/pull/14332#issuecomment-1586934091

   SonarCloud Quality Gate failed.&nbsp; &nbsp; [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=14332)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=CODE_SMELL) [![B](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/B-16px.png 'B')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=CODE_SMELL) [20 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=CODE_SMELL)
   
   [![46.6%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/40-16px.png '46.6%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14332&metric=new_coverage&view=list) [46.6% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14332&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14332&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14332&metric=new_duplicated_lines_density&view=list)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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


[GitHub] [dolphinscheduler] ruanwenjun commented on a diff in pull request #14332: [Improvement-14331][common] Remove the duplicate ParameterUtils

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on code in PR #14332:
URL: https://github.com/apache/dolphinscheduler/pull/14332#discussion_r1227544237


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/ParameterUtils.java:
##########
@@ -1,133 +0,0 @@
-/*
- * 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.dolphinscheduler.plugin.task.api.utils;
-
-import org.apache.dolphinscheduler.common.constants.DateConstants;
-import org.apache.dolphinscheduler.common.utils.DateUtils;
-import org.apache.dolphinscheduler.plugin.task.api.model.Property;
-import org.apache.dolphinscheduler.plugin.task.api.parser.PlaceholderUtils;
-import org.apache.dolphinscheduler.plugin.task.api.parser.TimePlaceholderUtils;
-
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * parameter parse utils
- */
-public class ParameterUtils {

Review Comment:
   Keep one class is great, since it is a util, so put under utils is better.



##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/ParameterUtils.java:
##########
@@ -1,133 +0,0 @@
-/*
- * 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.dolphinscheduler.plugin.task.api.utils;
-
-import org.apache.dolphinscheduler.common.constants.DateConstants;
-import org.apache.dolphinscheduler.common.utils.DateUtils;
-import org.apache.dolphinscheduler.plugin.task.api.model.Property;
-import org.apache.dolphinscheduler.plugin.task.api.parser.PlaceholderUtils;
-import org.apache.dolphinscheduler.plugin.task.api.parser.TimePlaceholderUtils;
-
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * parameter parse utils
- */
-public class ParameterUtils {

Review Comment:
   Keep one class is great, since it is a util, so under utils is better.



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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


[GitHub] [dolphinscheduler] rickchengx commented on pull request #14332: [Improvement-14331][common] Remove the duplicate ParameterUtils

Posted by "rickchengx (via GitHub)" <gi...@apache.org>.
rickchengx commented on PR #14332:
URL: https://github.com/apache/dolphinscheduler/pull/14332#issuecomment-1588655555

   Hi, @ruanwenjun , I've moved the merged util class under `utils` module, please review this again.


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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


[GitHub] [dolphinscheduler] ruanwenjun commented on a diff in pull request #14332: [Improvement-14331][common] Remove the duplicate ParameterUtils

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on code in PR #14332:
URL: https://github.com/apache/dolphinscheduler/pull/14332#discussion_r1226421362


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/ParameterUtils.java:
##########
@@ -1,133 +0,0 @@
-/*
- * 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.dolphinscheduler.plugin.task.api.utils;
-
-import org.apache.dolphinscheduler.common.constants.DateConstants;
-import org.apache.dolphinscheduler.common.utils.DateUtils;
-import org.apache.dolphinscheduler.plugin.task.api.model.Property;
-import org.apache.dolphinscheduler.plugin.task.api.parser.PlaceholderUtils;
-import org.apache.dolphinscheduler.plugin.task.api.parser.TimePlaceholderUtils;
-
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * parameter parse utils
- */
-public class ParameterUtils {

Review Comment:
   I would like to keep this under utils rather than move to parser



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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


[GitHub] [dolphinscheduler] rickchengx commented on a diff in pull request #14332: [Improvement-14331][common] Remove the duplicate ParameterUtils

Posted by "rickchengx (via GitHub)" <gi...@apache.org>.
rickchengx commented on code in PR #14332:
URL: https://github.com/apache/dolphinscheduler/pull/14332#discussion_r1226430620


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/ParameterUtils.java:
##########
@@ -1,133 +0,0 @@
-/*
- * 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.dolphinscheduler.plugin.task.api.utils;
-
-import org.apache.dolphinscheduler.common.constants.DateConstants;
-import org.apache.dolphinscheduler.common.utils.DateUtils;
-import org.apache.dolphinscheduler.plugin.task.api.model.Property;
-import org.apache.dolphinscheduler.plugin.task.api.parser.PlaceholderUtils;
-import org.apache.dolphinscheduler.plugin.task.api.parser.TimePlaceholderUtils;
-
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * parameter parse utils
- */
-public class ParameterUtils {

Review Comment:
   Hi, @ruanwenjun , thanks for you comment
   
   There are 2 `ParameterUtils` and a `ParamUtils` under `task-api` module, and there are many common methods in these 3 classes, such as `convert()`, `dateTemplateParse()`, `convertParameterPlaceholders()`
   
   I think they should be unified in one utils class (which package to put this class in can be discussed), WDYT



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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


[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #14332: [Improvement-14331][common] Remove the duplicate ParameterUtils

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14332:
URL: https://github.com/apache/dolphinscheduler/pull/14332#issuecomment-1586938551

   SonarCloud Quality Gate failed.&nbsp; &nbsp; [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=14332)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=CODE_SMELL) [5 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14332&resolved=false&types=CODE_SMELL)
   
   [![46.6%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/40-16px.png '46.6%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14332&metric=new_coverage&view=list) [46.6% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14332&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14332&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14332&metric=new_duplicated_lines_density&view=list)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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


[GitHub] [dolphinscheduler] rickchengx commented on a diff in pull request #14332: [Improvement-14331][common] Remove the duplicate ParameterUtils

Posted by "rickchengx (via GitHub)" <gi...@apache.org>.
rickchengx commented on code in PR #14332:
URL: https://github.com/apache/dolphinscheduler/pull/14332#discussion_r1227574560


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/ParameterUtils.java:
##########
@@ -1,133 +0,0 @@
-/*
- * 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.dolphinscheduler.plugin.task.api.utils;
-
-import org.apache.dolphinscheduler.common.constants.DateConstants;
-import org.apache.dolphinscheduler.common.utils.DateUtils;
-import org.apache.dolphinscheduler.plugin.task.api.model.Property;
-import org.apache.dolphinscheduler.plugin.task.api.parser.PlaceholderUtils;
-import org.apache.dolphinscheduler.plugin.task.api.parser.TimePlaceholderUtils;
-
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * parameter parse utils
- */
-public class ParameterUtils {

Review Comment:
   > Keep one class is great, since it is a util, so under utils is better.
   
   Sure, I got you



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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


[GitHub] [dolphinscheduler] ruanwenjun merged pull request #14332: [Improvement-14331][common] Remove the duplicate ParameterUtils

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun merged PR #14332:
URL: https://github.com/apache/dolphinscheduler/pull/14332


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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