You can have an error so early that some engine fields are uninitialized. Commit protects RunReport from these errors

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4185 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2010-09-01 19:00:25 +00:00
parent a975db2c2e
commit 995cfe34fe
2 changed files with 7 additions and 3 deletions

View File

@ -976,7 +976,7 @@ public class GenomeAnalysisEngine {
* @return cumulative metrics about the entire run.
*/
public ReadMetrics getCumulativeMetrics() {
return readsDataSource.getCumulativeReadMetrics();
return readsDataSource == null ? null : readsDataSource.getCumulativeReadMetrics();
}
/**

View File

@ -182,8 +182,6 @@ public class GATKRunReport {
Date end = new java.util.Date();
endTime = dateFormat.format(end);
runTime = (end.getTime() - engine.getStartTime().getTime()) / 1000L; // difference in seconds
nIterations = engine.getCumulativeMetrics().getNumIterations();
nReads = engine.getCumulativeMetrics().getNumReadsSeen();
tmpDir = System.getProperty("java.io.tmpdir");
// deal with memory usage
@ -191,6 +189,12 @@ public class GATKRunReport {
maxMemory = Runtime.getRuntime().maxMemory();
totalMemory = Runtime.getRuntime().totalMemory();
// we can only do some operations if an error hasn't occurred
if ( engine.getCumulativeMetrics() != null ) {
// it's possible we aborted so early that these data structures arent initialized
nIterations = engine.getCumulativeMetrics().getNumIterations();
nReads = engine.getCumulativeMetrics().getNumReadsSeen();
}
// user and hostname -- information about the runner of the GATK
userName = System.getProperty("user.name");