From 6b4a1e3b9fce86461910f19729805439404ac513 Mon Sep 17 00:00:00 2001 From: hanna Date: Mon, 9 Aug 2010 00:12:09 +0000 Subject: [PATCH] Reenabling code that was commented out after it was confirmed to work by many participating in this thread: http://getsatisfaction.com/gsa/topics/error_thrown_when_reading_reference_file git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3981 348d0f76-0448-11de-a6fe-93d51630548a --- .../ReferenceDataSource.java | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/ReferenceDataSource.java b/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/ReferenceDataSource.java index b9c848c6b..ab6b7502d 100644 --- a/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/ReferenceDataSource.java +++ b/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/ReferenceDataSource.java @@ -143,39 +143,39 @@ public class ReferenceDataSource implements ReferenceDataSourceProgressListener * but is incomplete). To avoid this, obtain shared locks on both files before creating IndexedFastaSequenceFile. */ -// FSLockWithShared dictLock = new FSLockWithShared(dictFile,true); -// FSLockWithShared indexLock = new FSLockWithShared(indexFile,true); -// try { -// try { -// if (!dictLock.sharedLock()) { -// throw new StingException("Could not open dictionary file because a lock could not be obtained."); -// } -// } -// catch(FileSystemInabilityToLockException ex) { -// logger.info(String.format("Unable to create a lock on dictionary file: %s",ex.getMessage())); -// logger.info("Treating existing dictionary file as complete."); -// } -// -// try { -// if (!indexLock.sharedLock()) { -// throw new StingException("Could not open index file because a lock could not be obtained."); -// } -// } -// catch(FileSystemInabilityToLockException ex) { -// logger.info(String.format("Unable to create a lock on index file: %s",ex.getMessage())); -// logger.info("Treating existing index file as complete."); -// } + FSLockWithShared dictLock = new FSLockWithShared(dictFile,true); + FSLockWithShared indexLock = new FSLockWithShared(indexFile,true); + try { + try { + if (!dictLock.sharedLock()) { + throw new StingException("Could not open dictionary file because a lock could not be obtained."); + } + } + catch(FileSystemInabilityToLockException ex) { + logger.info(String.format("Unable to create a lock on dictionary file: %s",ex.getMessage())); + logger.info("Treating existing dictionary file as complete."); + } - index = new IndexedFastaSequenceFile(fastaFile); -// -// } -// catch (Exception e) { -// throw new StingException(String.format("Error reading fasta file %s.", fastaFile.getAbsolutePath()), e); -// } -// finally { -// dictLock.unlock(); -// indexLock.unlock(); -// } + try { + if (!indexLock.sharedLock()) { + throw new StingException("Could not open index file because a lock could not be obtained."); + } + } + catch(FileSystemInabilityToLockException ex) { + logger.info(String.format("Unable to create a lock on index file: %s",ex.getMessage())); + logger.info("Treating existing index file as complete."); + } + + index = new IndexedFastaSequenceFile(fastaFile); + + } + catch (Exception e) { + throw new StingException(String.format("Error reading fasta file %s.", fastaFile.getAbsolutePath()), e); + } + finally { + dictLock.unlock(); + indexLock.unlock(); + } } /**