Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Genesys Backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
18
Issues
18
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Genesys PGR
Genesys Backend
Commits
e048caf1
Commit
e048caf1
authored
Aug 02, 2018
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed NPE when JSON cannot be parsed to Accession
parent
57c7445c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
src/main/java/org/genesys2/server/service/worker/AccessionUploader.java
...org/genesys2/server/service/worker/AccessionUploader.java
+8
-8
No files found.
src/main/java/org/genesys2/server/service/worker/AccessionUploader.java
View file @
e048caf1
...
...
@@ -132,31 +132,31 @@ public class AccessionUploader implements InitializingBean {
responses
.
add
(
new
AccessionOpResponse
(
accession
.
getInstituteCode
(),
accession
.
getAccessionNumber
(),
accession
.
getTaxonomy
().
getGenus
()));
}
catch
(
IOException
e
)
{
LOG
.
error
(
"Could not parse input: {}"
,
e
.
getMessage
(),
e
);
accessions
.
add
(
null
);
accessions
.
add
(
null
);
// need to match get(index) with responses and updates
responses
.
add
(
new
AccessionOpResponse
(
accn
.
get
(
"instituteCode"
).
asText
(),
accn
.
get
(
"accessionNumber"
).
asText
(),
accn
.
get
(
"taxonomy"
).
get
(
"genus"
).
asText
())
.
setResult
(
new
UpsertResult
(
UpsertResult
.
Type
.
ERROR
)).
setError
(
e
.
getMessage
()));
}
}
List
<
Accession
>
forUpdate
=
new
ArrayList
<>(
accessions
.
size
());
forUpdate
.
addAll
(
accessions
);
// Security check
for
(
int
i
=
0
;
i
<
accessions
.
size
();
i
++)
{
Accession
accession
=
accessions
.
get
(
i
);
if
(
accession
==
null
)
{
continue
;
}
if
(!
institute
.
getCode
().
equals
(
accession
.
getInstituteCode
()))
{
throw
new
InvalidApiUsageException
(
"Accession does not belong to institute "
+
institute
.
getCode
());
}
}
List
<
Accession
>
existingAccessions
=
accessionRepository
.
find
(
forUpdate
);
LOG
.
debug
(
"Have {} accessions for update and {} exist"
,
forUpdate
.
size
(),
existingAccessions
.
size
());
List
<
Accession
>
existingAccessions
=
accessionRepository
.
find
(
accessions
);
LOG
.
debug
(
"Have {} accessions for update and {} exist"
,
accessions
.
size
(),
existingAccessions
.
size
());
for
(
int
i
=
0
;
i
<
forUpdate
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
accessions
.
size
();
i
++)
{
final
JsonNode
update
=
updates
.
get
(
i
);
// Should we?
final
Accession
forU
=
forUpdate
.
get
(
i
);
final
Accession
forU
=
accessions
.
get
(
i
);
if
(
forU
==
null
)
{
LOG
.
debug
(
"Skipping update of {}"
,
update
);
continue
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment