Netflix / eureka

AWS Service registry for resilient mid-tier load balancing and failover.
Apache License 2.0
12.42k stars 3.75k forks source link

It is easy to trigger null pointer exception #1427

Closed wcnnkh closed 3 years ago

wcnnkh commented 3 years ago

https://github.com/Netflix/eureka/blob/4d36f04849541df6c6b8738622544d1b26dfe8d4/eureka-core/src/main/java/com/netflix/eureka/util/StatusUtil.java#L59-L61

https://github.com/Netflix/eureka/blob/4d36f04849541df6c6b8738622544d1b26dfe8d4/eureka-core/src/main/java/com/netflix/eureka/util/StatusInfo.java#L105-L107

wcnnkh commented 3 years ago

If the first step is not executed during construction, the method calling the second step will throw a null pointer exception. Can you change it to: public boolean isHealthy() { return isHeathly == null? false:isHeathly.booleanValue(); }

troshko111 commented 3 years ago

SGTM, feel free to send a PR.

wcnnkh commented 3 years ago

Push to that branch?Master?

troshko111 commented 3 years ago

You won't be able to push to origin/master, need to fork and send a PR which I see you did.

troshko111 commented 3 years ago

Closed, see the PR response here for more details.