Commit 3507bdd63caf2041d28ee5e4da0d8d740ccbd4c6

Authored by Nathanael Jourdane
1 parent f00cb6bb
Exists in master

sendGet() is now public and returns a StringBuffer instead writing on a file.

src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableConnection.java
... ... @@ -78,7 +78,11 @@ public final class VOTableConnection {
78 78 }
79 79  
80 80 logger.info("request: " + uri + "?" + parameters);
81   - VOTableConnection.sendGet(uri, parameters, voTablePath);
  81 + try {
  82 + printRequestResult(sendGet(uri, parameters), voTablePath);
  83 + } catch (IOException e) {
  84 + throw new HTTPRequestException("Can not print the result in a file.", e);
  85 + }
82 86  
83 87 return voTablePath;
84 88 }
... ... @@ -90,7 +94,7 @@ public final class VOTableConnection {
90 94 * @throws HTTPRequestException Can not send the request.
91 95 * @throws BadRequestException If the
92 96 */
93   - private static void sendGet(String url, String urlParameters, String resultFileName)
  97 + public static StringBuilder sendGet(String url, String urlParameters)
94 98 throws HTTPRequestException, BadRequestException {
95 99 String inputLine;
96 100 StringBuilder response = new StringBuilder();
... ... @@ -147,12 +151,7 @@ public final class VOTableConnection {
147 151 }
148 152 }
149 153  
150   - try {
151   - printRequestResult(response, resultFileName);
152   - } catch (IOException e) {
153   - throw new HTTPRequestException("Can not print the result in a file.", e);
154   - }
155   -
  154 + return response;
156 155 }
157 156  
158 157 /**
... ...