ContentStreamUpdateRequest no longer closes stream
Hello, I'm in the process of moving from Solr 6. to Solr 8.
We have a client application that streams CSV files to Solr using
ContentStreamUpdateRequest and then deletes the CSV file once the data is
indexed. That worked fine in Solr 6, but when using 8, the file is locked
and can't be deleted. (This is on Windows)
This seems to be because of the changes made in
https://issues.apache.org/jira/browse/SOLR-12142
*@Override public RequestWriter.ContentWriter getContentWriter(String
expectedType) { if (contentStreams == null || contentStreams.isEmpty()
|| contentStreams.size() > 1) return null; ContentStream stream =
contentStreams.get(0); return new RequestWriter.ContentWriter() {
@Override public void write(OutputStream os) throws IOException {
IOUtils.copy(stream.getStream(), os); } @Override public
String getContentType() { return stream.getContentType(); }
}; }*
As far as I know, IOUtils.copy will not close the stream.
Adding a close to it, is enough to "fix" it for me
- try { IOUtils.copy(innerStream, os); }
finally { IOUtils.closeQuietly(innerStream); }*
I've attached a simple test case. It passes with the change above and fails
without it.
So, is this a bug, or is there something I'm supposed to be doing elsewhere
to close the stream?
Thanks,
Colvin
トピックへ返信するには、ログインが必要です。