samtools / htsjdk

A Java API for high-throughput sequencing data (HTS) formats.
http://samtools.github.io/htsjdk/
283 stars 242 forks source link

SAMFileWriter does not do proper cleanup on IOException #1444

Closed duffrohde closed 4 years ago

duffrohde commented 4 years ago

Description

In case an IOException is encountered during closing of the SAMFileWriter the contained alignment sorter is not properly closed and as a result temporary sorting files potentially end up being left behind. This is fixed by putting the cleanup of the alignment sorter within a finally block.

codecov-io commented 4 years ago

Codecov Report

Merging #1444 into master will decrease coverage by 0.005%. The diff coverage is 80%.

@@               Coverage Diff               @@
##              master     #1444       +/-   ##
===============================================
- Coverage     68.401%   68.396%   -0.005%     
+ Complexity      8498      8497        -1     
===============================================
  Files            583       583               
  Lines          34412     34413        +1     
  Branches        5729      5729               
===============================================
- Hits           23538     23537        -1     
- Misses          8652      8653        +1     
- Partials        2222      2223        +1
Impacted Files Coverage Δ Complexity Δ
...c/main/java/htsjdk/samtools/SAMFileWriterImpl.java 80.822% <80%> (-1.123%) 25 <4> (ø)
...samtools/util/AsyncBlockCompressedInputStream.java 72% <0%> (-4%) 12% <0%> (-1%)
...dk/samtools/seekablestream/SeekableHTTPStream.java 58.824% <0%> (-1.471%) 14% <0%> (-1%)
src/main/java/htsjdk/samtools/BAMFileReader.java 68.466% <0%> (+0.852%) 52% <0%> (+1%) :arrow_up: