git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e0f2d37
)
JAL-2620 improved error reporting on failure to load resource files
author
gmungoc
<g.m.carstairs@dundee.ac.uk>
Wed, 27 Mar 2019 17:06:12 +0000
(17:06 +0000)
committer
gmungoc
<g.m.carstairs@dundee.ac.uk>
Wed, 27 Mar 2019 17:06:12 +0000
(17:06 +0000)
src/jalview/analysis/GeneticCodes.java
patch
|
blob
|
history
diff --git
a/src/jalview/analysis/GeneticCodes.java
b/src/jalview/analysis/GeneticCodes.java
index
d07253e
..
137b7f8
100644
(file)
--- a/
src/jalview/analysis/GeneticCodes.java
+++ b/
src/jalview/analysis/GeneticCodes.java
@@
-65,7
+65,7
@@
public final class GeneticCodes
loadAmbiguityCodes(AMBIGUITY_CODES_FILE);
loadCodes(RESOURCE_FILE);
}
loadAmbiguityCodes(AMBIGUITY_CODES_FILE);
loadCodes(RESOURCE_FILE);
}
- };
+ }
/**
* Returns the singleton instance of this class
/**
* Returns the singleton instance of this class
@@
-117,6
+117,11
@@
public final class GeneticCodes
try
{
InputStream is = getClass().getResourceAsStream(fileName);
try
{
InputStream is = getClass().getResourceAsStream(fileName);
+ if (is == null)
+ {
+ System.err.println("Resource file not found: " + fileName);
+ return;
+ }
BufferedReader dataIn = new BufferedReader(new InputStreamReader(is));
/*
BufferedReader dataIn = new BufferedReader(new InputStreamReader(is));
/*
@@
-136,9
+141,15
@@
public final class GeneticCodes
} catch (IOException | NullPointerException e)
{
Cache.log.error(
} catch (IOException | NullPointerException e)
{
Cache.log.error(
- "Error reading genetic codes data file: "
+ "Error reading genetic codes data file " + fileName + ": "
+ e.getMessage());
}
+ e.getMessage());
}
+ if (codeTables.isEmpty())
+ {
+ System.err.println(
+ "No genetic code tables loaded, check format of file "
+ + fileName);
+ }
}
/**
}
/**
@@
-157,6
+168,11
@@
public final class GeneticCodes
try
{
InputStream is = getClass().getResourceAsStream(fileName);
try
{
InputStream is = getClass().getResourceAsStream(fileName);
+ if (is == null)
+ {
+ System.err.println("Resource file not found: " + fileName);
+ return;
+ }
BufferedReader dataIn = new BufferedReader(new InputStreamReader(is));
String line = "";
while (line != null)
BufferedReader dataIn = new BufferedReader(new InputStreamReader(is));
String line = "";
while (line != null)
@@
-165,8
+181,16
@@
public final class GeneticCodes
if (line != null && !"DNA".equals(line.toUpperCase()))
{
String[] tokens = line.split("\\t");
if (line != null && !"DNA".equals(line.toUpperCase()))
{
String[] tokens = line.split("\\t");
+ if (tokens.length == 2)
+ {
ambiguityCodes.put(tokens[0].toUpperCase(),
tokens[1].toUpperCase());
ambiguityCodes.put(tokens[0].toUpperCase(),
tokens[1].toUpperCase());
+ }
+ else
+ {
+ System.err.println(
+ "Unexpected data in " + fileName + ": " + line);
+ }
}
}
} catch (IOException e)
}
}
} catch (IOException e)