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

[GitHub] [eventmesh] kyooosukedn opened a new pull request, #3660: Prevent NPE

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

   <!--
   ### Contribution Checklist
   
     - Name the pull request in the form "[ISSUE #XXXX] Title of the pull request", 
       where *XXXX* should be replaced by the actual issue number.
       Skip *[ISSUE #XXXX]* if there is no associated github issue for this pull request.
   
     - Fill out the template below to describe the changes contributed by the pull request. 
       That will give reviewers the context they need to do the review.
     
     - Each pull request should address only one issue. 
       Please do not mix up code from multiple issues.
     
     - Each commit in the pull request should have a meaningful commit message.
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, 
       leaving only the filled out template below.
   
   (The sections below can be removed for hotfixes of typos)
   -->
   
   <!--
   (If this PR fixes a GitHub issue, please add `Fixes #<XXX>` or `Closes #<XXX>`.)
   -->
   
   Fixes #3649 .
   
   
   ### Modifications
   
   *Added Objects.requireNonNull() in line 121 and 130 as well as the import java.util.Objects.*
   
   
   
   ### Documentation
   
   - Does this pull request introduce a new feature? (no)
   - If yes, how is the feature documented? (not applicable )
   
   


-- 
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


[GitHub] [eventmesh] Alonexc commented on pull request #3660: [ISSUE #3649] Method invocation may produce 'NullPointerException'.[CloudEventsProtocolAdaptor]

Posted by "Alonexc (via GitHub)" <gi...@apache.org>.
Alonexc commented on PR #3660:
URL: https://github.com/apache/eventmesh/pull/3660#issuecomment-1504396055

   Download this plugin:
   ![image](https://user-images.githubusercontent.com/91315508/231323936-470dfee5-3f0e-4a85-926e-2be229bb7707.png)
   Import the checkstyle of the local project and check the box.
   ![image](https://user-images.githubusercontent.com/91315508/231324086-b1950be8-20f2-4c32-8a1f-2ec667029228.png)
   ![image](https://user-images.githubusercontent.com/91315508/231324178-c77abafa-8d4c-4bf9-bfb8-c6ccb1d539b2.png)
   ![image](https://user-images.githubusercontent.com/91315508/231324427-00b5a351-0ad5-4c96-a978-2e24cb26d83a.png)
   
   
   


-- 
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


[GitHub] [eventmesh] mxsm commented on a diff in pull request #3660: [ISSUE #3649] Method invocation may produce 'NullPointerException'.[CloudEventsProtocolAdaptor]

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


##########
eventmesh-protocol-plugin/eventmesh-protocol-cloudevents/src/main/java/org/apache/eventmesh/protocol/cloudevents/CloudEventsProtocolAdaptor.java:
##########
@@ -127,7 +128,8 @@ public ProtocolTransportObject fromCloudEvent(CloudEvent cloudEvent) throws Prot
                 @Override
                 public Map<String, Object> toMap() {
                     byte[] eventByte =
-                        EventFormatProvider.getInstance().resolveFormat(JsonFormat.CONTENT_TYPE).serialize(cloudEvent);
+                        Objects.requireNonNull(EventFormatProvider.getInstance()
+                            .resolveFormat(JsonFormat.CONTENT_TYPE)).serialize(cloudEvent);
                     map.put("content", new String(eventByte, StandardCharsets.UTF_8));

Review Comment:
   StandardCharsets.UTF_8 replace with Constants.DEFAULT_CHARSET



-- 
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


[GitHub] [eventmesh] kyooosukedn commented on pull request #3660: [ISSUE #3649] Method invocation may produce 'NullPointerException'.[CloudEventsProtocolAdaptor]

Posted by "kyooosukedn (via GitHub)" <gi...@apache.org>.
kyooosukedn commented on PR #3660:
URL: https://github.com/apache/eventmesh/pull/3660#issuecomment-1505850496

   @Alonexc @xwm1992  Thank 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: 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


[GitHub] [eventmesh] kyooosukedn commented on pull request #3660: [ISSUE #3649] Method invocation may produce 'NullPointerException'.[CloudEventsProtocolAdaptor]

Posted by "kyooosukedn (via GitHub)" <gi...@apache.org>.
kyooosukedn commented on PR #3660:
URL: https://github.com/apache/eventmesh/pull/3660#issuecomment-1504052510

   @Alonexc I think my checkstyle doesn't work anymore, what command do you use to check that? I tried mvn checkstyle:checkstyle but my pom.xml is not really integrating with my directory hence its not working. 


-- 
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


[GitHub] [eventmesh] codecov[bot] commented on pull request #3660: [ISSUE #3649] Method invocation may produce 'NullPointerException'.[CloudEventsProtocolAdaptor]

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

   ## [Codecov](https://codecov.io/gh/apache/eventmesh/pull/3660?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 [#3660](https://codecov.io/gh/apache/eventmesh/pull/3660?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (923addf) into [master](https://codecov.io/gh/apache/eventmesh/commit/228cc82a041d8de747efc2a398f6a0d78799728b?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (228cc82) will **decrease** coverage by `0.86%`.
   > The diff coverage is `6.66%`.
   
   > :exclamation: Current head 923addf differs from pull request most recent head 5ead7b3. Consider uploading reports for the commit 5ead7b3 to get more accurate results
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3660      +/-   ##
   ============================================
   - Coverage     14.62%   13.76%   -0.86%     
   + Complexity     1526     1292     -234     
   ============================================
     Files           651      571      -80     
     Lines         31713    29239    -2474     
     Branches       3032     2884     -148     
   ============================================
   - Hits           4638     4026     -612     
   + Misses        26659    24840    -1819     
   + Partials        416      373      -43     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/eventmesh/pull/3660?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...in/java/org/apache/eventmesh/common/Constants.java](https://codecov.io/gh/apache/eventmesh/pull/3660?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9Db25zdGFudHMuamF2YQ==) | `85.71% <ø> (ø)` | |
   | [.../apache/eventmesh/common/config/ConfigService.java](https://codecov.io/gh/apache/eventmesh/pull/3660?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9jb25maWcvQ29uZmlnU2VydmljZS5qYXZh) | `44.44% <0.00%> (ø)` | |
   | [.../eventmesh/common/enums/EventMeshProtocolType.java](https://codecov.io/gh/apache/eventmesh/pull/3660?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9lbnVtcy9FdmVudE1lc2hQcm90b2NvbFR5cGUuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...ventmesh/common/protocol/tcp/EventMeshMessage.java](https://codecov.io/gh/apache/eventmesh/pull/3660?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9wcm90b2NvbC90Y3AvRXZlbnRNZXNoTWVzc2FnZS5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...rotocol/workflow/protos/EventmeshWorkflowGrpc.java](https://codecov.io/gh/apache/eventmesh/pull/3660?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9wcm90b2NvbC93b3JrZmxvdy9wcm90b3MvRXZlbnRtZXNoV29ya2Zsb3dHcnBjLmphdmE=) | `0.00% <ø> (ø)` | |
   | [.../org/apache/eventmesh/common/EventMeshMessage.java](https://codecov.io/gh/apache/eventmesh/pull/3660?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9FdmVudE1lc2hNZXNzYWdlLmphdmE=) | `35.29% <100.00%> (+3.71%)` | :arrow_up: |
   
   ... and [246 files with indirect coverage changes](https://codecov.io/gh/apache/eventmesh/pull/3660/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   :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=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: 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


[GitHub] [eventmesh] Alonexc commented on pull request #3660: [ISSUE #3649] Method invocation may produce 'NullPointerException'.[CloudEventsProtocolAdaptor]

Posted by "Alonexc (via GitHub)" <gi...@apache.org>.
Alonexc commented on PR #3660:
URL: https://github.com/apache/eventmesh/pull/3660#issuecomment-1502841700

   ![image](https://user-images.githubusercontent.com/91315508/231090086-2ab0464c-f91f-495b-92a4-b460fb3f6456.png)
   please check checkstyle.


-- 
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


[GitHub] [eventmesh] xwm1992 merged pull request #3660: [ISSUE #3649] Method invocation may produce 'NullPointerException'.[CloudEventsProtocolAdaptor]

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


-- 
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