Francesco Croci created SOLR-5845:
-------------------------------------
Summary: File locked afetr indexing
Key: SOLR-5845
URL: https://issues.apache.org/jira/browse/SOLR-5845
Project: Solr
Issue Type: Bug
Affects Versions: 4.6
Environment: solr 4.6.0, java 1.6
Reporter: Francesco Croci
This bug seams to be related to
[this|https://issues.apache.org/jira/browse/SOLR-1744] which is marked as
closed fixed, but I still have the same problem.
In my (web)application I download a pdf file, index it and than delete it.
The last step doesn't work. Even if I try to manually delete the file, it says
that the file is open in Java(TM) 2 Platform SE binary.
Here is what I tried:
{code}
...
ContentStream contentStream = null;
try
{
contentStream = new ContentStreamBase.FileStream(file);
ContentStreamUpdateRequest req = new
ContentStreamUpdateRequest("/update/extract");
// req.addFile(file,
context.getProperty(FTSConstants.CONTENT_TYPE_APPLICATION_PDF)); // <-- without
stream but the result is the same: the file is locked
req.addContentStream(contentStream);
req.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
NamedList<Object> result = server.request(req);
if (!((NamedList<?>) result.get("responseHeader")).get("status").equals(0))
{
throw new IDSystemException(LOG, "Document could not be indexed. Status
returned: " + ((NamedList<?>) result.get("responseHeader")).get("status"));
}
}
catch (FileNotFoundException fnfe)
{
throw new IDSystemException(LOG, fnfe.getMessage(), fnfe);
}
catch (IOException ioe)
{
throw new IDSystemException(LOG, ioe.getMessage(), ioe);
}
catch (SolrServerException sse)
{
throw new IDSystemException(LOG, sse.getMessage(), sse);
}
finally
{
try
{
if (contentStream != null && contentStream.getStream() != null)
{
contentStream.getStream().close();
}
}
catch (IOException ioe)
{
throw new IDSystemException(LOG, ioe.getMessage(), ioe);
}
}
deleteDocument(file);
...
{code}
In deleteDocument(file), file.delete() returns false.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]