-
Notifications
You must be signed in to change notification settings - Fork 739
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
GHMilestone throws NPE on null state #2028
Comments
PR welcome. There's an enum helper class in this library that will supply a default value when enum conversion fails. It just wasn't used here. |
@rnveach |
While scanning https://github.com/checkstyle/checkstyle/issues , I pick up issue 16243. I call https://api.github.com/repos/checkstyle/checkstyle/issues/16243/events In my dump of Just my assumption not knowing anything and thinking about your question and seeing the events URL, maybe an event milestone ( If this is the case, then this issue isn't about null protection, but changing |
This seems to be the specific section in the REST API from the link you provided under response schema.
Only title is expected back here. |
I think this issue also expands to labels returned from Schema from spec:
There is only name and color. |
Ah, different endpoint. Got it. |
The following method is not
null
safe:github-api/src/main/java/org/kohsuke/github/GHMilestone.java
Lines 137 to 138 in 0556380
Whenever it is called to get the state of the milestone, and it (
state
field) isnull
, it will throw aNullPointerException
.There is no other method in this class to ascertain the value of this before calling the method. The field is private. Programmers are forced to wrap this in a try/catch in the case it is null.
It would ease handling this call if it had a
null
check and returnednull
if there is no state.The text was updated successfully, but these errors were encountered: