This is an automated email from the ASF dual-hosted git repository. xiangfu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push: new 3d9d206 Fixing missing error message from pinot-admin command (#5305) 3d9d206 is described below commit 3d9d2063afb513a979d7d4ff6a597dccbe89ba80 Author: Xiang Fu <fx19880...@gmail.com> AuthorDate: Mon Apr 27 11:36:47 2020 -0700 Fixing missing error message from pinot-admin command (#5305) * Fixing the missed error message from Pinot Server when using pinot-admin command * Update PinotTableRestletResource.java * Update AddTableCommand.java * Update PinotTableRestletResourceTest.java --- .../tools/admin/command/AbstractBaseAdminCommand.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AbstractBaseAdminCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AbstractBaseAdminCommand.java index 6c37405..14922d7 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AbstractBaseAdminCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AbstractBaseAdminCommand.java @@ -23,6 +23,7 @@ import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; @@ -86,14 +87,20 @@ public class AbstractBaseAdminCommand extends AbstractBaseCommand { writer.flush(); } - final BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); - final StringBuilder sb = new StringBuilder(); - String line = null; + try { + return readInputStream(conn.getInputStream()); + } catch (Exception e) { + return readInputStream(conn.getErrorStream()); + } + } + private static String readInputStream(InputStream inputStream) throws IOException { + final BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); + final StringBuilder sb = new StringBuilder(); + String line; while ((line = reader.readLine()) != null) { sb.append(line); } - return sb.toString(); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org