From: gmungoc Date: Tue, 29 Jan 2019 11:32:18 +0000 (+0000) Subject: Merge branch 'feature/JAL-3143ensemblJSON' into trialMerge X-Git-Tag: Release_2_11_4_0~45^2~18^2~273^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=212a3358f824e06b94742b49676b07a69028b159;p=jalview.git Merge branch 'feature/JAL-3143ensemblJSON' into trialMerge Conflicts: src/jalview/ext/ensembl/EnsemblFeatures.java --- 212a3358f824e06b94742b49676b07a69028b159 diff --cc src/jalview/ext/ensembl/EnsemblFeatures.java index 2772498,744191d..2dd6ebb --- a/src/jalview/ext/ensembl/EnsemblFeatures.java +++ b/src/jalview/ext/ensembl/EnsemblFeatures.java @@@ -108,24 -111,20 +108,22 @@@ class EnsemblFeatures extends EnsemblRe * @param br * @return */ - private SequenceI parseFeaturesJson(BufferedReader br) + @SuppressWarnings("unchecked") - private SequenceI parseFeaturesJson(List queries) ++ private SequenceI parseFeaturesJson(List queries) { - - SequenceI seq = new Sequence("Dummy", ""); -- - JSONParser jp = new JSONParser(); try { - - JSONArray responses = (JSONArray) jp.parse(br); - Iterator rvals = responses.iterator(); - while (rvals.hasNext()) + Iterator rvals = (Iterator) getJSON(null, queries, -1, MODE_ITERATOR, null); + if (rvals == null) + { + return null; ++ } + while (rvals.hasNext()) + { try { - JSONObject obj = (JSONObject) rvals.next(); + Map obj = (Map) rvals.next(); String type = obj.get("feature_type").toString(); int start = Integer.parseInt(obj.get("start").toString()); int end = Integer.parseInt(obj.get("end").toString()); @@@ -186,23 -184,25 +185,24 @@@ * @param keys * @return */ - protected String getFirstNotNull(JSONObject obj, String... keys) ++ @SuppressWarnings("unchecked") + protected String getFirstNotNull(Map obj, String... keys) { -- String desc = null; -- for (String key : keys) { Object val = obj.get(key); if (val != null) { - String s = val.toString(); - String s = val instanceof JSONArray - ? JSONUtils.arrayToList((JSONArray) val) ++ String s = val instanceof List ++ ? JSONUtils.arrayToStringList((List) val) + : val.toString(); if (!s.isEmpty()) { return s; } } } -- return desc; ++ return null; } /**