Merge branch 'bug/JAL-2253' into develop
authorJim Procter <jprocter@issues.jalview.org>
Mon, 23 Oct 2017 14:00:38 +0000 (15:00 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 23 Oct 2017 14:00:38 +0000 (15:00 +0100)
JAL-2253 resolve diffrences between patches post-code review and diverging develop

1  2 
src/jalview/ext/ensembl/EnsemblGene.java
src/jalview/ext/ensembl/EnsemblRestClient.java
src/jalview/ext/ensembl/EnsemblSymbol.java
src/jalview/ext/ensembl/EnsemblXref.java

@@@ -94,7 -78,7 +85,7 @@@ abstract class EnsemblRestClient extend
  
    static
    {
--    domainData = new HashMap<String, EnsemblInfo>();
++    domainData = new HashMap<>();
      domainData.put(ENSEMBL_REST,
              new EnsemblInfo(ENSEMBL_REST, LATEST_ENSEMBL_REST_VERSION));
      domainData.put(ENSEMBL_GENOMES_REST, new EnsemblInfo(
    {
      JSONParser jp = new JSONParser();
      URL url = null;
 +    BufferedReader br = null;
 +
      try
      {
-       url = new URL(
-               getDomain() + "/info/data?content-type=application/json");
+       url = new URL(getDomain() + "/info/data" + CONTENT_TYPE_JSON);
 -      BufferedReader br = getHttpResponse(url, null);
 +      br = getHttpResponse(url, null);
        if (br != null)
        {
          JSONObject val = (JSONObject) jp.parse(br);
@@@ -119,18 -143,22 +143,19 @@@ public class EnsemblSymbol extends Ense
      {
        for (String query : queries)
        {
 -        for (Species taxon : Species.values())
 +        for (Species taxon : Species.getModelOrganisms())
          {
-           URL url = getUrl(query, taxon);
 -          if (taxon.isModelOrganism())
++          URL url = getUrl(query, taxon, GENE);
 +          if (url != null)
            {
 -            URL url = getUrl(query, taxon, GENE);
 -            if (url != null)
 +            br = getHttpResponse(url, ids);
 +            if (br != null)
              {
 -              br = getHttpResponse(url, ids);
 -              if (br != null)
 +              String geneId = parseSymbolResponse(br);
-               if (geneId != null)
++              System.out.println(url + " returned " + geneId);
++              if (geneId != null && !result.contains(geneId))
                {
 -                String geneId = parseSymbolResponse(br);
 -                System.out.println(url + " returned " + geneId);
 -                if (geneId != null && !result.contains(geneId))
 -                {
 -                  result.add(geneId);
 -                }
 +                result.add(geneId);
                }
              }
            }