samtools / htsjdk

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

Change try-finally to try-with-resources in MetricsFile.write #1505

Closed lbergelson closed 4 years ago

lbergelson commented 4 years ago

Description

There's a weird failure state in CrosscheckFingerPrints where it ends without an exception but writes no metrics. One possible explanation is that the order of exception suppression is suppressing the causal exception and then we're discarding the new exception.

This cleans up the code and changes the order of suppression to match what we want.

lbergelson commented 4 years ago

@pshapiro4broad I'm also kind of skeptical, but it's the only plausible scenario we've come up with so far.

codecov-commenter commented 4 years ago

Codecov Report

Merging #1505 into master will increase coverage by 0.002%. The diff coverage is 0.000%.

@@               Coverage Diff               @@
##              master     #1505       +/-   ##
===============================================
+ Coverage     69.348%   69.350%   +0.002%     
+ Complexity      8893      8892        -1     
===============================================
  Files            601       601               
  Lines          35436     35432        -4     
  Branches        5900      5899        -1     
===============================================
- Hits           24574     24572        -2     
+ Misses          8533      8530        -3     
- Partials        2329      2330        +1     
Impacted Files Coverage Δ Complexity Δ
...main/java/htsjdk/samtools/metrics/MetricsFile.java 61.265% <0.000%> (+0.954%) 48.000 <0.000> (ø)
...htsjdk/samtools/util/nio/DeleteOnExitPathHook.java 80.952% <0.000%> (-9.524%) 3.000% <0.000%> (-1.000%)