You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Christine Poerschke (JIRA)" <ji...@apache.org> on 2018/10/16 16:49:00 UTC

[jira] [Commented] (SOLR-12877) reduce test failures due to NullPointerException

    [ https://issues.apache.org/jira/browse/SOLR-12877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16652055#comment-16652055 ] 

Christine Poerschke commented on SOLR-12877:
--------------------------------------------

Having a {{assertNotNull(bar);}} check at each and every possible point is not practical of course but instead the scope and intention of this ticket here could be to add {{assertNotNull(bar);}} in cases where the subsequent use of {{bar}} has been seen to result in a NPE. Does that kind of make sense?

> reduce test failures due to NullPointerException
> ------------------------------------------------
>
>                 Key: SOLR-12877
>                 URL: https://issues.apache.org/jira/browse/SOLR-12877
>             Project: Solr
>          Issue Type: Test
>            Reporter: Christine Poerschke
>            Priority: Minor
>
> Creating this as an umbrella ticket for fixing various NullPointerExceptions e.g. encounted in this type of code pattern in tests:
> before:
> {code:java}
> Bar bar = foo.getBar(id);
> assertEquals(42, bar.size()); // if bar is null we hit a NPE here
> {code}
> after:
> {code:java}
> Bar bar = foo.getBar(id);
> assertNotNull(bar); // if bar is null the test now fails here
> assertEquals(42, bar.size());
> {code}
> The test failure itself would still remain a test failure but a slightly clearer one perhaps.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org