From 65f577b174bd50e70e18d594481723e9c5c390ed Mon Sep 17 00:00:00 2001 From: Nathanael Jourdane Date: Thu, 21 Apr 2016 12:26:40 +0200 Subject: [PATCH] minor VOResourceCtrl improvment --- src/main/java/eu/omp/irap/vespa/epntapclient/lib/resource/VOResourceCtrl.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/lib/resource/VOResourceCtrl.java b/src/main/java/eu/omp/irap/vespa/epntapclient/lib/resource/VOResourceCtrl.java index a31b91f..dbf66d0 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/lib/resource/VOResourceCtrl.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/lib/resource/VOResourceCtrl.java @@ -111,7 +111,7 @@ public class VOResourceCtrl { public static List getIvoidResources(Map keywords) throws VOResourceException { - List ivoidResources = null; + List ivoidResources; keywords.put("standardid", VOResourceCtrl.VORESOURCES_STANDARDID); keywords.put("datamodel", VOResourceCtrl.VORESOURCES_DATAMODEL); @@ -127,11 +127,7 @@ public class VOResourceCtrl { try { String ivoidResourcesPath = Network.saveQuery(VOResourceCtrl.GET_VORESOURCE_URL, parameters); - try { - ivoidResources = VOResourceCtrl.parseIvoidResources(ivoidResourcesPath); - } catch (FileNotFoundException e) { - throw new CantReadVOResourceException(ivoidResourcesPath, e); - } + ivoidResources = VOResourceCtrl.parseIvoidResources(ivoidResourcesPath); } catch (CantSendQueryException e1) { throw new CantGetVOResourceException(VOResourceCtrl.GET_VORESOURCE_URL, e1); // TODO: pass the entire request. @@ -140,8 +136,13 @@ public class VOResourceCtrl { } private static List parseIvoidResources(String ivoidResourcesPath) - throws FileNotFoundException { - JsonReader reader = new JsonReader(new FileReader(ivoidResourcesPath)); + throws CantReadVOResourceException { + JsonReader reader; + try { + reader = new JsonReader(new FileReader(ivoidResourcesPath)); + } catch (FileNotFoundException e) { + throw new CantReadVOResourceException(ivoidResourcesPath, e); + } JsonObject root = new JsonParser().parse(reader).getAsJsonObject(); JsonArray resources = root.get("resources").getAsJsonArray(); -- libgit2 0.21.2