Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
6904198b
Commit
6904198b
authored
Jan 27, 2017
by
Piotr Gawron
Browse files
error handling ehen there is an issue with mesh data
parent
626ae33c
Changes
2
Hide whitespace changes
Inline
Side-by-side
annotation/src/main/java/lcsb/mapviewer/annotation/cache/XmlSerializer.java
View file @
6904198b
...
...
@@ -20,7 +20,7 @@ import org.w3c.dom.Node;
* type of the object to serialize
*/
public
class
XmlSerializer
<
T
>
{
/**
* Class of the object that DAO works on.
*/
...
...
@@ -93,6 +93,8 @@ public class XmlSerializer<T> {
return
(
T
)
jaxbUnmarshaller
.
unmarshal
(
node
);
}
catch
(
JAXBException
e
)
{
throw
new
SerializationException
(
e
);
}
catch
(
Exception
e
)
{
//the library can throw NPE sometimes...
throw
new
SerializationException
(
e
);
}
}
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/MeSHParser.java
View file @
6904198b
...
...
@@ -2,6 +2,9 @@ package lcsb.mapviewer.annotation.services;
import
java.io.IOException
;
import
javax.sql.rowset.serial.SerialException
;
import
org.apache.commons.lang3.SerializationException
;
import
org.apache.log4j.Logger
;
import
org.w3c.dom.Node
;
...
...
@@ -100,16 +103,22 @@ public class MeSHParser extends CachableInterface implements IExternalService {
String
id
=
getIdentifier
(
meshID
);
Node
meshNode
=
super
.
getCacheNode
(
id
);
if
(
meshNode
!=
null
&&
meshNode
.
hasChildNodes
())
{
mesh
=
meshSerializer
.
xmlToObject
(
meshNode
);
}
else
{
try
{
mesh
=
meshSerializer
.
xmlToObject
(
meshNode
);
}
catch
(
SerializationException
e
)
{
logger
.
warn
(
"Problem with processing cached info about mesh: "
+
meshID
);
mesh
=
null
;
}
}
if
(
mesh
==
null
)
{
try
{
mesh
=
getMeSHByIdFromDB
(
meshID
);
}
catch
(
IOException
e
)
{
throw
new
AnnotatorException
(
"Problem with accessing MeSH database"
,
e
);
}
if
(
mesh
!=
null
)
{
super
.
setCacheValue
(
id
,
this
.
meshSerializer
.
objectToString
(
mesh
));
}
}
if
(
mesh
!=
null
)
{
super
.
setCacheValue
(
id
,
this
.
meshSerializer
.
objectToString
(
mesh
));
}
return
mesh
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment