Skip to content
Snippets Groups Projects
Commit 8f6f1f3a authored by kaloyane's avatar kaloyane
Browse files

minor FIXME resolved: HierarchicalContent is also closed when an I/O error occurs

SVN: 21515
parent 06d31c6a
No related branches found
No related tags found
No related merge requests found
......@@ -68,17 +68,22 @@ public class FtpFileImpl extends AbstractFtpFile
public InputStream createInputStream(long offset) throws IOException
{
IHierarchicalContent content = createHierarchicalContent();
IHierarchicalContentNode contentNode = getContentNodeForThisFile(content);
InputStream result =
HierarchicalContentUtils.getInputStreamAutoClosingContent(contentNode, content);
try
{
IHierarchicalContentNode contentNode = getContentNodeForThisFile(content);
InputStream result =
HierarchicalContentUtils.getInputStreamAutoClosingContent(contentNode, content);
if (offset > 0)
if (offset > 0)
{
result.skip(offset);
}
return result;
} catch (IOException ioex)
{
result.skip(offset);
content.close();
return null;
}
return result;
// FIXME content is not closed if exception occurs
}
public long getLastModified()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment