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
cf2b0525
Commit
cf2b0525
authored
Jan 31, 2017
by
Piotr Gawron
Browse files
error handling improved in serialization of mesh data
parent
85dd9930
Changes
2
Hide whitespace changes
Inline
Side-by-side
annotation/src/main/java/lcsb/mapviewer/annotation/cache/XmlSerializer.java
View file @
cf2b0525
...
...
@@ -53,7 +53,7 @@ public class XmlSerializer<T> {
jaxbMarshaller
.
setProperty
(
Marshaller
.
JAXB_FORMATTED_OUTPUT
,
true
);
jaxbUnmarshaller
=
jaxbContext
.
createUnmarshaller
();
}
catch
(
JAXBException
e
)
{
throw
new
SerializationException
();
throw
new
SerializationException
(
e
);
}
}
...
...
@@ -73,6 +73,8 @@ public class XmlSerializer<T> {
jaxbMarshaller
.
marshal
(
object
,
sw
);
}
catch
(
JAXBException
e
)
{
throw
new
SerializationException
(
e
);
}
catch
(
Exception
e
)
{
throw
new
SerializationException
(
e
);
}
return
sw
.
toString
();
}
...
...
@@ -93,6 +95,8 @@ public class XmlSerializer<T> {
return
(
T
)
jaxbUnmarshaller
.
unmarshal
(
node
);
}
catch
(
JAXBException
e
)
{
throw
new
SerializationException
(
e
);
}
catch
(
Exception
e
)
{
throw
new
SerializationException
(
e
);
}
}
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/MeSHParser.java
View file @
cf2b0525
...
...
@@ -2,6 +2,7 @@ package lcsb.mapviewer.annotation.services;
import
java.io.IOException
;
import
org.apache.commons.lang3.SerializationException
;
import
org.apache.log4j.Logger
;
import
org.w3c.dom.Node
;
...
...
@@ -100,16 +101,21 @@ 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 mesh data for: "
+
meshID
);
}
}
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