Skip to content

Commit 019ccd4

Browse files
Dmitry Avtonomovfcyu
Dmitry Avtonomov
authored andcommitted
Add extra fasta path checks
1 parent a2a351f commit 019ccd4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

MSFragger-GUI/src/com/dmtavt/fragpipe/tabs/TabDatabase.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
import java.awt.Dimension;
4646
import java.awt.event.ActionEvent;
4747
import java.io.IOException;
48+
import java.nio.file.AccessDeniedException;
49+
import java.nio.file.Files;
4850
import java.nio.file.Path;
4951
import java.nio.file.Paths;
5052
import java.util.stream.Stream;
@@ -234,12 +236,19 @@ public String getFastaPath() {
234236

235237
private void validateFasta(String path) {
236238
try {
239+
if (path != null && !Files.exists(Paths.get(path))) {
240+
log.debug("Got bad FASTA path: {}", path);
241+
Bus.postSticky(new NoteConfigDatabase());
242+
return;
243+
}
237244
Path p = PathUtils.existing(path, true);
238245
FastaContent fasta = FastaUtils.readFasta(p);
239246
final String tag = getDecoyTag();
240247
int decoysCnt = (int)FastaUtils.getDecoysCnt(fasta.ordered.get(0), tag);
241248
int protsTotal = FastaUtils.getProtsTotal(fasta.ordered.get(0));
242249
Bus.postSticky(new NoteConfigDatabase(Paths.get(path), protsTotal, decoysCnt, true));
250+
} catch (AccessDeniedException e) {
251+
log.warn("No access to FASTA file path: {}", path);
243252
} catch (Exception e) {
244253
log.debug("Got bad FASTA path: {}", path);
245254
Bus.postSticky(new NoteConfigDatabase());

0 commit comments

Comments
 (0)