From a121588dfd083662659e96c32be2f075ffd5e924 Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Wed, 26 Jul 2017 11:03:34 +0200
Subject: [PATCH] when data in database is wrong exception is properly handled

---
 .../mapviewer/annotation/services/ChemicalParser.java    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/ChemicalParser.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/ChemicalParser.java
index 74e38ec3bf..df03d1175c 100644
--- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/ChemicalParser.java
+++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/ChemicalParser.java
@@ -12,6 +12,7 @@ import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.apache.commons.lang3.SerializationException;
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.w3c.dom.Node;
@@ -353,8 +354,12 @@ public class ChemicalParser extends CachableInterface implements IExternalServic
 		// look for chemical in the cache
 		Node chemicalNode = super.getCacheNode(getIdentifier(diseaseID, chemicalId));
 		if (chemicalNode != null && chemicalNode.hasChildNodes()) {
-			result = chemicalSerializer.xmlToObject(chemicalNode);
-			return result;
+			try {
+				result = chemicalSerializer.xmlToObject(chemicalNode);
+				return result;
+			} catch (SerializationException e) {
+				logger.error(e, e);
+			}
 		}
 		try {
 			String diseaseQuery = DISEASE_URL + diseaseID.getResource();
-- 
GitLab