You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by "yanrongzhen (via GitHub)" <gi...@apache.org> on 2023/10/23 07:01:38 UTC

[PR] [ISSUE#4459] Fix unchecked call to a original type member (eventmesh)

yanrongzhen opened a new pull request, #4506:
URL: https://github.com/apache/eventmesh/pull/4506

   Fixes #4459 .
   
   ### Modifications
   Fix unchecked call to a original type member
   


-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


Re: [PR] [ISSUE#4459] Fix unchecked call to a original type member (eventmesh)

Posted by "yanrongzhen (via GitHub)" <gi...@apache.org>.
yanrongzhen commented on code in PR #4506:
URL: https://github.com/apache/eventmesh/pull/4506#discussion_r1368271448


##########
eventmesh-security-plugin/eventmesh-security-auth-token/src/main/java/org/apache/eventmesh/auth/token/impl/auth/AuthTokenUtils.java:
##########
@@ -136,14 +137,15 @@ public static boolean authAccess(AclProperties aclProperties) {
 
         String topic = aclProperties.getTopic();
 
-        Set<String> groupTopics = (Set<String>) aclProperties.getExtendedField("topics");
+        Object topics = aclProperties.getExtendedField("topics");
 
-        if (groupTopics.contains(topic)) {
-            return true;
-        } else {
-            return false;
+        if (!(topics instanceof Set)) {
+            throw new RuntimeException("abc");

Review Comment:
   Oops, fixed.



-- 
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: issues-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


Re: [PR] [ISSUE#4459] Fix unchecked call to a original type member (eventmesh)

Posted by "Pil0tXia (via GitHub)" <gi...@apache.org>.
Pil0tXia commented on code in PR #4506:
URL: https://github.com/apache/eventmesh/pull/4506#discussion_r1368623258


##########
eventmesh-security-plugin/eventmesh-security-auth-token/src/main/java/org/apache/eventmesh/auth/token/impl/auth/AuthTokenUtils.java:
##########
@@ -136,14 +137,15 @@ public static boolean authAccess(AclProperties aclProperties) {
 
         String topic = aclProperties.getTopic();
 
-        Set<String> groupTopics = (Set<String>) aclProperties.getExtendedField("topics");
+        Object topics = aclProperties.getExtendedField("topics");

Review Comment:
   This modification can have impacts on code readability and it is recommended to add some comments if there is no better solution.



-- 
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: issues-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


Re: [PR] [ISSUE#4459] Fix unchecked call to a original type member (eventmesh)

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #4506:
URL: https://github.com/apache/eventmesh/pull/4506#issuecomment-1774731371

   ## [Codecov](https://app.codecov.io/gh/apache/eventmesh/pull/4506?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   > Merging [#4506](https://app.codecov.io/gh/apache/eventmesh/pull/4506?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (cab56c4) into [master](https://app.codecov.io/gh/apache/eventmesh/commit/d3f688dd09d51e4dee275cae1d334f4c6138ae59?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (d3f688d) will **decrease** coverage by `0.01%`.
   > The diff coverage is `33.33%`.
   
   > :exclamation: Current head cab56c4 differs from pull request most recent head c0612bc. Consider uploading reports for the commit c0612bc to get more accurate results
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #4506      +/-   ##
   ============================================
   - Coverage     15.47%   15.47%   -0.01%     
   - Complexity     1452     1454       +2     
   ============================================
     Files           691      692       +1     
     Lines         28106    28103       -3     
     Branches       2626     2612      -14     
   ============================================
   - Hits           4349     4348       -1     
   + Misses        23312    23310       -2     
     Partials        445      445              
   ```
   
   
   | [Files](https://app.codecov.io/gh/apache/eventmesh/pull/4506?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [...sh/storage/rocketmq/consumer/PushConsumerImpl.java](https://app.codecov.io/gh/apache/eventmesh/pull/4506?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZXZlbnRtZXNoLXN0b3JhZ2UtcGx1Z2luL2V2ZW50bWVzaC1zdG9yYWdlLXJvY2tldG1xL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9ldmVudG1lc2gvc3RvcmFnZS9yb2NrZXRtcS9jb25zdW1lci9QdXNoQ29uc3VtZXJJbXBsLmphdmE=) | `24.47% <ø> (ø)` | |
   | [...ics/prometheus/metrics/PrometheusGrpcExporter.java](https://app.codecov.io/gh/apache/eventmesh/pull/4506?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZXZlbnRtZXNoLW1ldHJpY3MtcGx1Z2luL2V2ZW50bWVzaC1tZXRyaWNzLXByb21ldGhldXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9tZXRyaWNzL3Byb21ldGhldXMvbWV0cmljcy9Qcm9tZXRoZXVzR3JwY0V4cG9ydGVyLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...ics/prometheus/metrics/PrometheusHttpExporter.java](https://app.codecov.io/gh/apache/eventmesh/pull/4506?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZXZlbnRtZXNoLW1ldHJpY3MtcGx1Z2luL2V2ZW50bWVzaC1tZXRyaWNzLXByb21ldGhldXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9tZXRyaWNzL3Byb21ldGhldXMvbWV0cmljcy9Qcm9tZXRoZXVzSHR0cEV4cG9ydGVyLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...rics/prometheus/metrics/PrometheusTcpExporter.java](https://app.codecov.io/gh/apache/eventmesh/pull/4506?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZXZlbnRtZXNoLW1ldHJpY3MtcGx1Z2luL2V2ZW50bWVzaC1tZXRyaWNzLXByb21ldGhldXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9tZXRyaWNzL3Byb21ldGhldXMvbWV0cmljcy9Qcm9tZXRoZXVzVGNwRXhwb3J0ZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...tocol/http/processor/inf/HttpRequestProcessor.java](https://app.codecov.io/gh/apache/eventmesh/pull/4506?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZXZlbnRtZXNoLXJ1bnRpbWUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9ydW50aW1lL2NvcmUvcHJvdG9jb2wvaHR0cC9wcm9jZXNzb3IvaW5mL0h0dHBSZXF1ZXN0UHJvY2Vzc29yLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...a/org/apache/eventmesh/common/utils/TypeUtils.java](https://app.codecov.io/gh/apache/eventmesh/pull/4506?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi91dGlscy9UeXBlVXRpbHMuamF2YQ==) | `62.50% <62.50%> (ø)` | |
   | [...rics/prometheus/utils/PrometheusExporterUtils.java](https://app.codecov.io/gh/apache/eventmesh/pull/4506?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZXZlbnRtZXNoLW1ldHJpY3MtcGx1Z2luL2V2ZW50bWVzaC1tZXRyaWNzLXByb21ldGhldXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9tZXRyaWNzL3Byb21ldGhldXMvdXRpbHMvUHJvbWV0aGV1c0V4cG9ydGVyVXRpbHMuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   
   ... and [12 files with indirect coverage changes](https://app.codecov.io/gh/apache/eventmesh/pull/4506/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: issues-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


Re: [PR] [ISSUE#4459] Fix unchecked call to a original type member (eventmesh)

Posted by "pandaapo (via GitHub)" <gi...@apache.org>.
pandaapo commented on code in PR #4506:
URL: https://github.com/apache/eventmesh/pull/4506#discussion_r1368228200


##########
eventmesh-security-plugin/eventmesh-security-auth-token/src/main/java/org/apache/eventmesh/auth/token/impl/auth/AuthTokenUtils.java:
##########
@@ -136,14 +137,15 @@ public static boolean authAccess(AclProperties aclProperties) {
 
         String topic = aclProperties.getTopic();
 
-        Set<String> groupTopics = (Set<String>) aclProperties.getExtendedField("topics");
+        Object topics = aclProperties.getExtendedField("topics");
 
-        if (groupTopics.contains(topic)) {
-            return true;
-        } else {
-            return false;
+        if (!(topics instanceof Set)) {
+            throw new RuntimeException("abc");

Review Comment:
   "abc"?



-- 
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: issues-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


Re: [PR] [ISSUE#4459] Fix unchecked call to a original type member (eventmesh)

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


-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org