From fc92b70f2cc8440a11442c7a1d733bc2cabdb1df Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Wed, 17 Jan 2018 17:26:53 +0100
Subject: [PATCH] chemical connector uses api over ssl and due to change of
 http response status error handling slightly changed

---
 .../annotation/services/ChemicalParser.java          | 12 ++++++------
 .../annotation/services/ChemicalParserTest.java      |  2 +-
 2 files changed, 7 insertions(+), 7 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 df03d1175c..014346e376 100644
--- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/ChemicalParser.java
+++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/ChemicalParser.java
@@ -57,18 +57,18 @@ public class ChemicalParser extends CachableInterface implements IExternalServic
 	/**
 	 * Homepage of drugbank.
 	 */
-	static final String							URL															= "http://ctdbase.org/";
+	static final String							URL															= "https://ctdbase.org/";
 
 	/**
 	 * URL to get a list of chemicals by disease id.
 	 */
-	public static final String			DISEASE_URL											= "http://ctdbase.org/detail.go?6578706f7274=1&d-1332398-e=5&view=chem&"
+	public static final String			DISEASE_URL											= "https://ctdbase.org/detail.go?6578706f7274=1&d-1332398-e=5&view=chem&"
 			+ "type=disease&acc=MESH%3A";
 
 	/**
 	 * URL to get a list of chemicals by gene id.
 	 */
-	public static final String			DISEASE_GENE_URL								= "http://ctdbase.org/detail.go?slimTerm=all&6578706f7274=1&qid=3464576&"
+	public static final String			DISEASE_GENE_URL								= "https://ctdbase.org/detail.go?slimTerm=all&6578706f7274=1&qid=3464576&"
 			+ "d-1332398-e=5&view=disease&type=gene&assnType=curated&acc=";
 
 	/**
@@ -218,7 +218,7 @@ public class ChemicalParser extends CachableInterface implements IExternalServic
 				}
 			}
 
-		} catch (FileNotFoundException e) {
+		} catch (WrongResponseCodeIOException e) {
 			// it means that there are no results for this query
 		} catch (IOException e) {
 			throw new ChemicalSearchException("ctdbase service unavailable", e);
@@ -447,14 +447,14 @@ public class ChemicalParser extends CachableInterface implements IExternalServic
 				if (entrez == null) {
 					invalidHgnc.add(md);
 				} else {
-					String query = "http://ctdbase.org/detail.go?type=gene&view=ixn&chemAcc=" + chemID.getResource() + "&acc=" + entrez.getResource();
+					String query = "https://ctdbase.org/detail.go?type=gene&view=ixn&chemAcc=" + chemID.getResource() + "&acc=" + entrez.getResource();
 					String referencesPage = getWebPageContent(query);
 					Matcher matcher = pattern.matcher(referencesPage);
 					while (matcher.find()) {
 						idx.add(matcher.group(1));
 					}
 					for (String string : idx) {
-						String query2 = "http://ctdbase.org/detail.go?6578706f7274=1&d-1340579-e=5&type=relationship&ixnId=" + string;
+						String query2 = "https://ctdbase.org/detail.go?6578706f7274=1&d-1340579-e=5&type=relationship&ixnId=" + string;
 						String referencesPage2 = getWebPageContent(query2);
 						String[] lines = referencesPage2.split("\n");
 						for (int i = 1; i < lines.length; i++) {
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/ChemicalParserTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/ChemicalParserTest.java
index f03eb92e17..38fa0393ed 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/ChemicalParserTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/ChemicalParserTest.java
@@ -551,7 +551,7 @@ public class ChemicalParserTest extends AnnotationTestFunctions {
 			// remove info about single publication from cache (so we will have to
 			// download it)
 			chemicalParser.getCache().removeByQuery(
-					"http://ctdbase.org/detail.go?6578706f7274=1&d-1340579-e=5&type=relationship&ixnId=4802115", chemicalParser.getCacheType());
+					"https://ctdbase.org/detail.go?6578706f7274=1&d-1340579-e=5&type=relationship&ixnId=4802115", chemicalParser.getCacheType());
 
 			// disallow to use cache for first query (it will be directly about drug),
 			// so parser will have to parse results taking data from cache (or
-- 
GitLab