Commit 65f577b174bd50e70e18d594481723e9c5c390ed

Authored by Nathanael Jourdane
1 parent 7191e325
Exists in master

minor VOResourceCtrl improvment

src/main/java/eu/omp/irap/vespa/epntapclient/lib/resource/VOResourceCtrl.java
... ... @@ -111,7 +111,7 @@ public class VOResourceCtrl {
111 111  
112 112 public static List<String> getIvoidResources(Map<String, String> keywords)
113 113 throws VOResourceException {
114   - List<String> ivoidResources = null;
  114 + List<String> ivoidResources;
115 115  
116 116 keywords.put("standardid", VOResourceCtrl.VORESOURCES_STANDARDID);
117 117 keywords.put("datamodel", VOResourceCtrl.VORESOURCES_DATAMODEL);
... ... @@ -127,11 +127,7 @@ public class VOResourceCtrl {
127 127 try {
128 128 String ivoidResourcesPath = Network.saveQuery(VOResourceCtrl.GET_VORESOURCE_URL,
129 129 parameters);
130   - try {
131   - ivoidResources = VOResourceCtrl.parseIvoidResources(ivoidResourcesPath);
132   - } catch (FileNotFoundException e) {
133   - throw new CantReadVOResourceException(ivoidResourcesPath, e);
134   - }
  130 + ivoidResources = VOResourceCtrl.parseIvoidResources(ivoidResourcesPath);
135 131 } catch (CantSendQueryException e1) {
136 132 throw new CantGetVOResourceException(VOResourceCtrl.GET_VORESOURCE_URL, e1);
137 133 // TODO: pass the entire request.
... ... @@ -140,8 +136,13 @@ public class VOResourceCtrl {
140 136 }
141 137  
142 138 private static List<String> parseIvoidResources(String ivoidResourcesPath)
143   - throws FileNotFoundException {
144   - JsonReader reader = new JsonReader(new FileReader(ivoidResourcesPath));
  139 + throws CantReadVOResourceException {
  140 + JsonReader reader;
  141 + try {
  142 + reader = new JsonReader(new FileReader(ivoidResourcesPath));
  143 + } catch (FileNotFoundException e) {
  144 + throw new CantReadVOResourceException(ivoidResourcesPath, e);
  145 + }
145 146 JsonObject root = new JsonParser().parse(reader).getAsJsonObject();
146 147 JsonArray resources = root.get("resources").getAsJsonArray();
147 148  
... ...