lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hoss Man (JIRA)" <j...@apache.org>
Subject [jira] Commented: (SOLR-2084) ContentStreamUpdateRequest should play nice even with no streams
Date Mon, 23 Aug 2010 22:53:29 GMT

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

Hoss Man commented on SOLR-2084:
--------------------------------

Hmm... poking arround the code for a few minutes, the bug isn't as obvious as i thought.

 i expected to see a List of ContentStreams in ContentStreamUpdateRequest that defaults to
"null", but that doesn't seem to be the case -- it appears to be correct in maintaining an
empty List.

the code arround line 381 or CommonsHttpSolrServer.request however seems fairly hokey.  It
seems to be making some odd decisions about when to use a multi-part request, and if it decides
it doesn't need a multipart request, then it assumes there is exactly one ContentStream --
there is no accounting for the possibility of an UpdateRequest that has zero streams.

(I'm not sure why UpdateRequest works even when no documents have been added ... it must tickle
some change in the code path)

It's seems like we should just simplify the code to always use multipart when doing POST requests,
and then a simple loop over the list of ContentStreams should work just fine.

> ContentStreamUpdateRequest should play nice even with no streams
> ----------------------------------------------------------------
>
>                 Key: SOLR-2084
>                 URL: https://issues.apache.org/jira/browse/SOLR-2084
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Hoss Man
>
> As noted by a user, attempting to use stream.file or stream.url with the ContentStreamUpdateRequest
(an understandable situation that might arise if people aren't completely clear on when it's
needed) can result in an NPE from CommonsHttpSolrServer (because it has no streams to send)
...
> {code}
> java.lang.NullPointerException
>         at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:381)
>         at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:243)
>         at CommonTest.indexFilesSolrCell(CommonTest.java:59)
>         at CommonTest.main(CommonTest.java:26)
> {code}
> UpdateRequest doesn't have this problem, In the pathological case of no streams ContentStreamUpdateRequest
should behave just like UpdateRequest and QueryRequest.

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


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


Mime
View raw message