FindBugs 'Maintainability' fixes

This commit is contained in:
Eric Banks 2012-08-16 15:53:06 -04:00
parent 05cbf1c8c0
commit 3253fc216b
8 changed files with 13 additions and 5 deletions

View File

@ -208,6 +208,7 @@ public class FastaSequenceIndexBuilder {
break;
}
}
in.close();
return sequenceIndex;
}
catch (IOException e) {

View File

@ -264,7 +264,7 @@ class SampleStatistics {
return false;
// different contigs
if (read.getMateReferenceIndex() != read.getReferenceIndex())
if (!read.getMateReferenceIndex().equals(read.getReferenceIndex()))
return false;
// unmapped

View File

@ -104,7 +104,9 @@ public class BAMDiffableReader implements DiffableReader {
InputStream fstream = new BufferedInputStream(new FileInputStream(file));
if ( !BlockCompressedInputStream.isValidFile(fstream) )
return false;
new BlockCompressedInputStream(fstream).read(buffer, 0, BAM_MAGIC.length);
final BlockCompressedInputStream BCIS = new BlockCompressedInputStream(fstream);
BCIS.read(buffer, 0, BAM_MAGIC.length);
BCIS.close();
return Arrays.equals(buffer, BAM_MAGIC);
} catch ( IOException e ) {
return false;

View File

@ -90,8 +90,10 @@ public class GATKReportDiffableReader implements DiffableReader {
public boolean canRead(File file) {
try {
final String HEADER = GATKReport.GATKREPORT_HEADER_PREFIX;
char[] buff = new char[HEADER.length()];
new FileReader(file).read(buff, 0, HEADER.length());
final char[] buff = new char[HEADER.length()];
final FileReader FR = new FileReader(file);
FR.read(buff, 0, HEADER.length());
FR.close();
String firstLine = new String(buff);
return firstLine.startsWith(HEADER);
} catch (IOException e) {

View File

@ -305,7 +305,7 @@ public class ConstrainedMateFixingManager {
}
public static boolean iSizeTooBigToMove(SAMRecord read, int maxInsertSizeForMovingReadPairs) {
return ( read.getReadPairedFlag() && ! read.getMateUnmappedFlag() && read.getReferenceName() != read.getMateReferenceName() ) // maps to different chromosomes
return ( read.getReadPairedFlag() && ! read.getMateUnmappedFlag() && !read.getReferenceName().equals(read.getMateReferenceName()) ) // maps to different chromosomes
|| Math.abs(read.getInferredInsertSize()) > maxInsertSizeForMovingReadPairs; // we won't try to move such a read
}

View File

@ -177,6 +177,7 @@ public class TrancheManager {
double runningValue = metric.getRunningMetric(i);
out.printf("%.4f %d %.4f%n", d.lod, score, runningValue);
}
out.close();
} catch (FileNotFoundException e) {
throw new UserException.CouldNotCreateOutputFile(f, e);
}

View File

@ -270,6 +270,7 @@ public class VariantsToBinaryPed extends RodWalker<Integer,Integer> {
inStream.read(readGenotypes);
outBed.write(readGenotypes);
}
inStream.close();
} catch (IOException e) {
throw new ReviewedStingException("Error reading form temp file for input.",e);
}

View File

@ -135,6 +135,7 @@ public class ForumAPIUtils {
System.out.println(line);
}
br.close();
httpClient.getConnectionManager().shutdown();
return output;