|
45 | 45 | import java.awt.Dimension;
|
46 | 46 | import java.awt.event.ActionEvent;
|
47 | 47 | import java.io.IOException;
|
| 48 | +import java.nio.file.AccessDeniedException; |
| 49 | +import java.nio.file.Files; |
48 | 50 | import java.nio.file.Path;
|
49 | 51 | import java.nio.file.Paths;
|
50 | 52 | import java.util.stream.Stream;
|
@@ -234,12 +236,19 @@ public String getFastaPath() {
|
234 | 236 |
|
235 | 237 | private void validateFasta(String path) {
|
236 | 238 | 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 | + } |
237 | 244 | Path p = PathUtils.existing(path, true);
|
238 | 245 | FastaContent fasta = FastaUtils.readFasta(p);
|
239 | 246 | final String tag = getDecoyTag();
|
240 | 247 | int decoysCnt = (int)FastaUtils.getDecoysCnt(fasta.ordered.get(0), tag);
|
241 | 248 | int protsTotal = FastaUtils.getProtsTotal(fasta.ordered.get(0));
|
242 | 249 | Bus.postSticky(new NoteConfigDatabase(Paths.get(path), protsTotal, decoysCnt, true));
|
| 250 | + } catch (AccessDeniedException e) { |
| 251 | + log.warn("No access to FASTA file path: {}", path); |
243 | 252 | } catch (Exception e) {
|
244 | 253 | log.debug("Got bad FASTA path: {}", path);
|
245 | 254 | Bus.postSticky(new NoteConfigDatabase());
|
|
0 commit comments