You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Todd Feak (JIRA)" <ji...@apache.org> on 2009/01/29 23:29:59 UTC

[jira] Updated: (SOLR-899) NullPointerException in ClientUtils.writeXML on NULL field value

     [ https://issues.apache.org/jira/browse/SOLR-899?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Todd Feak updated SOLR-899:
---------------------------

    Priority: Minor  (was: Trivial)

> NullPointerException in ClientUtils.writeXML on NULL field value
> ----------------------------------------------------------------
>
>                 Key: SOLR-899
>                 URL: https://issues.apache.org/jira/browse/SOLR-899
>             Project: Solr
>          Issue Type: Bug
>          Components: clients - java
>    Affects Versions: 1.3
>            Reporter: Todd Feak
>            Priority: Minor
>
> This exception occurs if I have a field in a document with a null value.
> java.lang.NullPointerException
> 	at org.apache.solr.client.solrj.util.ClientUtils.writeXML(ClientUtils.java:117)
> 	at org.apache.solr.client.solrj.request.UpdateRequest.getXML(UpdateRequest.java:169)
> 	at org.apache.solr.client.solrj.request.UpdateRequest.getContentStreams(UpdateRequest.java:160)
> ...
> Previous versions of this class had a null check, which was subsequently removed. I have no problem with removing the previous null-check, as it seemed to "hide" a programming mistake (i.e. null values). However, I think that the exception that occurs here could at least be a bit more informative. Performing a null check and then throwing some sort of RuntimeException or IOException with a descriptive message would be very helpful. Such as "Failure, NULL value for field named[foo] detected".
> Alternatively, I think that an argument could be made that this NULL shouldn't have been allowed in the document in the first place. If that is the case, then NULL checks with similarly helpful messages could be performed upstream of this issue. I personally lean this way, as I prefer to find a programming mistake closer to the source of the issue. It allows me to find out exactly where the NULL was inserted in the first place.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.