From 0d9a06bf189a2c10f982895a699399a5dd15893c Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Tue, 31 Jul 2018 12:13:43 +0200 Subject: [PATCH] exception passing improved --- .../services/annotators/ChebiAnnotator.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotator.java index cc2af5f03a..5a673aa4b6 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotator.java @@ -27,7 +27,6 @@ import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.species.Chemical; import lcsb.mapviewer.modelutils.map.ElementUtils; import uk.ac.ebi.chebi.webapps.chebiWS.client.ChebiWebServiceClient; -import uk.ac.ebi.chebi.webapps.chebiWS.model.ChebiWebServiceFault_Exception; import uk.ac.ebi.chebi.webapps.chebiWS.model.DataItem; import uk.ac.ebi.chebi.webapps.chebiWS.model.Entity; import uk.ac.ebi.chebi.webapps.chebiWS.model.LiteEntity; @@ -205,7 +204,7 @@ public class ChebiAnnotator extends ElementAnnotator implements IExternalService } } } - } catch (ChebiWebServiceFault_Exception e) { + } catch (Exception e) { throw new ChebiSearchException("Problem with chebi connection", e); } return null; @@ -290,7 +289,7 @@ public class ChebiAnnotator extends ElementAnnotator implements IExternalService String value = miriamListToStringList(result); setCacheValue(query, value); - } catch (ChebiWebServiceFault_Exception e) { + } catch (Exception e) { throw new ChebiSearchException("Problem with chebi", e); } return result; @@ -300,7 +299,7 @@ public class ChebiAnnotator extends ElementAnnotator implements IExternalService * Serialize list of chebi identifiers. * * @param list - * list of chebi identfiers + * list of chebi identifiers * @return string with identifiers */ private String miriamListToStringList(List<MiriamData> list) { @@ -357,7 +356,6 @@ public class ChebiAnnotator extends ElementAnnotator implements IExternalService } try { ChebiWebServiceClient client = getClient(); - LiteEntityList entities = client.getLiteEntity(id, SearchCategory.CHEBI_ID, MAX_SEARCH_RESULTS_FROM_CHEBI_API, StarsCategory.ALL); List<LiteEntity> resultList = entities.getListElement(); @@ -374,7 +372,7 @@ public class ChebiAnnotator extends ElementAnnotator implements IExternalService setCacheValue("id: " + id, chebiSerializer.objectToString(result)); } return result; - } catch (ChebiWebServiceFault_Exception e) { + } catch (Exception e) { throw new ChebiSearchException("Problem with chebi", e); } } @@ -387,7 +385,7 @@ public class ChebiAnnotator extends ElementAnnotator implements IExternalService * identifier): "CHEBI:XXXXX" or "XXXXX" * @return common name of chemical * @throws ChebiSearchException - * thrown when there is a problemw ith accessing information from + * thrown when there is a problem with accessing information from * external chebi database */ protected String getChebiNameForChebiId(MiriamData id) throws ChebiSearchException { -- GitLab