smolnar82 commented on a change in pull request #296: KNOX-2240 - KnoxShell
Custom Command for WEBHDFS Use
URL: https://github.com/apache/knox/pull/296#discussion_r396268208
##########
File path:
gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/CSVKnoxShellTableBuilder.java
##########
@@ -39,33 +41,47 @@ public CSVKnoxShellTableBuilder withHeaders() {
}
public KnoxShellTable url(String url) throws IOException {
- int rowIndex = 0;
URL urlToCsv = new URL(url);
URLConnection connection = urlToCsv.openConnection();
try (Reader urlConnectionStreamReader = new
InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8);
BufferedReader csvReader = new
BufferedReader(urlConnectionStreamReader);) {
- if (title != null) {
- this.table.title(title);
+ buildTableFromCSVReader(csvReader);
+ }
+ return this.table;
+ }
+
+ public KnoxShellTable string(String csvString) throws IOException {
+ InputStream is = new
ByteArrayInputStream(csvString.getBytes(StandardCharsets.UTF_8));
Review comment:
Why not move this into the `try` block so that `is` will be closed too.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services