eventmesh icon indicating copy to clipboard operation
eventmesh copied to clipboard

[Enhancement] Remove the redundant nullcheck of value previously dereferenced

Open kirinzhu opened this issue 2 years ago • 1 comments

Search before asking

  • [X] I had searched in the issues and found no similar issues.

Enhancement Request

It seems that the value value which is checked here can't be null because it was previously dereferenced and if it were null a null pointer exception would have occurred at the earlier dereference.

1st appearance: In module eventmesh-runtime In class org.apache.eventmesh.runtime.boot.EventMeshServer In method org.apache.eventmesh.runtime.boot.EventMeshServer.init() Value loaded from field org.apache.eventmesh.runtime.boot.EventMeshServer.eventMeshHttpConfiguration Redundant null check at EventMeshServer.java:[line 108]

2nd appearance: In module eventmesh-runtime In class org.apache.eventmesh.runtime.boot.EventMeshServer In method org.apache.eventmesh.runtime.boot.EventMeshServer.init() Value loaded from field org.apache.eventmesh.runtime.boot.EventMeshServer.eventMeshHttpConfiguration Redundant null check at EventMeshServer.java:[line 108]

Describe the solution you'd like

Maybe we could remove the redundant nullcheck

Are you willing to submit PR?

  • [ ] Yes I am willing to submit a PR!

kirinzhu avatar Jul 08 '22 07:07 kirinzhu

I will finish this issue .

misselvexu avatar Jul 11 '22 08:07 misselvexu