From 3507bdd63caf2041d28ee5e4da0d8d740ccbd4c6 Mon Sep 17 00:00:00 2001 From: Nathanael Jourdane Date: Thu, 10 Mar 2016 11:12:06 +0100 Subject: [PATCH] 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 | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableConnection.java b/src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableConnection.java index c8fbebf..0baffe7 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableConnection.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableConnection.java @@ -78,7 +78,11 @@ public final class VOTableConnection { } logger.info("request: " + uri + "?" + parameters); - VOTableConnection.sendGet(uri, parameters, voTablePath); + try { + printRequestResult(sendGet(uri, parameters), voTablePath); + } catch (IOException e) { + throw new HTTPRequestException("Can not print the result in a file.", e); + } return voTablePath; } @@ -90,7 +94,7 @@ public final class VOTableConnection { * @throws HTTPRequestException Can not send the request. * @throws BadRequestException If the */ - private static void sendGet(String url, String urlParameters, String resultFileName) + public static StringBuilder sendGet(String url, String urlParameters) throws HTTPRequestException, BadRequestException { String inputLine; StringBuilder response = new StringBuilder(); @@ -147,12 +151,7 @@ public final class VOTableConnection { } } - try { - printRequestResult(response, resultFileName); - } catch (IOException e) { - throw new HTTPRequestException("Can not print the result in a file.", e); - } - + return response; } /** -- libgit2 0.21.2