Skip to content

Fail Faster in TarExtractor #156

@gfs

Description

@gfs

If the TarExtractor fails to open the entry stream for an entry or to copy that to a new backing stream it catches the exception but continues parsing anyway. This likely doesn't make sense as if the stream is in an indeterminate state there's not much meaningful data there. This exception should clean up the now unused backing stream, and continue enumeration rather than continuing to try to parse this entry - or at least return a failed entry object (with an empty Content stream?). Should also check if this pattern exists in the other collectors.

try
{
using Stream tarStream = tarEntry.OpenEntryStream();
tarStream.CopyTo(fs);
}
catch (Exception e)
{
Logger.Debug(Extractor.FAILED_PARSING_ERROR_MESSAGE_STRING, ArchiveFileType.TAR, fileEntry.FullPath, tarEntry.Key, e.GetType());
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions