Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #3649] Method invocation may produce 'NullPointerException'.[CloudEventsProtocolAdaptor] #3660

Merged
merged 3 commits into from
Apr 13, 2023

Conversation

kyooosukedn
Copy link
Contributor

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 )

@kyooosukedn kyooosukedn changed the title Prevent NPE [ISSUE #3649] Method invocation may produce 'NullPointerException'.[CloudEventsProtocolAdaptor] Apr 7, 2023
Comment on lines 131 to 133
Objects.requireNonNull(EventFormatProvider.getInstance()
.resolveFormat(JsonFormat.CONTENT_TYPE)).serialize(cloudEvent);
map.put("content", new String(eventByte, StandardCharsets.UTF_8));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StandardCharsets.UTF_8 replace with Constants.DEFAULT_CHARSET

Alonexc
Alonexc previously approved these changes Apr 11, 2023
@Alonexc
Copy link
Contributor

Alonexc commented Apr 11, 2023

image
please check checkstyle.

@kyooosukedn
Copy link
Contributor Author

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

@Alonexc
Copy link
Contributor

Alonexc commented Apr 12, 2023

Download this plugin:
image

Import the checkstyle of the local project and check the box.
image
image
image

@codecov
Copy link

codecov bot commented Apr 12, 2023

Codecov Report

Merging #3660 (923addf) into master (228cc82) will decrease coverage by 0.86%.
The diff coverage is 6.66%.

❗ Current head 923addf differs from pull request most recent head 5ead7b3. Consider uploading reports for the commit 5ead7b3 to get more accurate results

@@             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 Coverage Δ
...in/java/org/apache/eventmesh/common/Constants.java 85.71% <ø> (ø)
.../apache/eventmesh/common/config/ConfigService.java 44.44% <0.00%> (ø)
.../eventmesh/common/enums/EventMeshProtocolType.java 0.00% <0.00%> (ø)
...ventmesh/common/protocol/tcp/EventMeshMessage.java 0.00% <0.00%> (ø)
...rotocol/workflow/protos/EventmeshWorkflowGrpc.java 0.00% <ø> (ø)
.../org/apache/eventmesh/common/EventMeshMessage.java 35.29% <100.00%> (+3.71%) ⬆️

... and 246 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@kyooosukedn
Copy link
Contributor Author

@Alonexc @xwm1992 Thank you :)

@xwm1992 xwm1992 merged commit 906fcdb into apache:master Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] Method invocation may produce 'NullPointerException'.[CloudEventsProtocolAdaptor]
4 participants