lmccay commented on a change in pull request #256: KNOX-2189 - 
KnoxShellTable.select() must handle whitespace
URL: https://github.com/apache/knox/pull/256#discussion_r376186205
 
 

 ##########
 File path: 
gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTable.java
 ##########
 @@ -356,7 +356,7 @@ public KnoxShellTableFilter filter() {
   public KnoxShellTable select(String cols) {
     KnoxShellTable table = new KnoxShellTable();
     List<List<Comparable<? extends Object>>> columns = new ArrayList<>();
-    String[] colnames = cols.split(",");
+    String[] colnames = cols.split(",\\s*");
 
 Review comment:
   It seems to me that it will "work" depending on what your expectations are. 
I don't believe that anyone would be surprised that a comma before a comma is 
left on the end of the previous string or if you have a trailing slash after 
the last name. It seems more of an explicit action to match the actual colName 
than a mistake to me.
   
   On the other hand, if your colName does have a trailing space for some 
reason there would be no way to use select to get it if you strip out all 
trailing spaces.
   
   I think this change should be for accommodating spaces following a comma as 
an extended delimiter. Of course, if you have colNames that have a leading 
slash will not work this way either. I guess we could add a new select method 
as well which takes a String[] where you can include all the spaces you want.
   
   For this particular method, I think this approach is fine.

----------------------------------------------------------------
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

Reply via email to