Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2XB3FinalProject
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christopher Schankula
2XB3FinalProject
Commits
d4f8828f
Commit
d4f8828f
authored
7 years ago
by
Christopher Schankula
Browse files
Options
Downloads
Patches
Plain Diff
error handling for nameToID
parent
6c63ed75
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/biotree/TestBioTree.java
+4
-1
4 additions, 1 deletion
src/biotree/TestBioTree.java
src/biotree/WormsAPI.java
+2
-2
2 additions, 2 deletions
src/biotree/WormsAPI.java
with
6 additions
and
3 deletions
src/biotree/TestBioTree.java
+
4
−
1
View file @
d4f8828f
...
...
@@ -2,13 +2,15 @@ package biotree;
import
static
org
.
junit
.
Assert
.*;
import
java.io.IOException
;
import
org.junit.Before
;
import
org.junit.Test
;
public
class
TestBioTree
{
@Before
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
BioTree
.
init
();
BioTree
.
processRecord
(
125125
);
BioTree
.
processRecord
(
125125
);
...
...
@@ -29,6 +31,7 @@ public class TestBioTree {
//System.out.println(String.format("%-26s %s", nodes.get(i).getName(), nodes.get(i).getTaxonType()));
//}
BioTree
.
printTree
();
System
.
out
.
println
(
WormsAPI
.
nameToID
(
"Hello"
));
}
...
...
This diff is collapsed.
Click to expand it.
src/biotree/WormsAPI.java
+
2
−
2
View file @
d4f8828f
...
...
@@ -38,11 +38,11 @@ public class WormsAPI {
* @return Aphia (taxon) ID of given scientific name.
* @throws IOException
*/
public
static
i
nt
nameToID
(
String
scientificName
)
throws
IOException
{
public
static
I
nt
eger
nameToID
(
String
scientificName
)
throws
IOException
{
scientificName
=
repSpaces
(
scientificName
);
String
resp
=
makeRequest
(
String
.
format
(
"http://marinespecies.org/rest/AphiaIDByName/%s?marine_only=false"
,
scientificName
));
if
(
resp
.
length
()
==
0
)
return
null
;
return
Integer
.
parseInt
(
resp
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment