Github user ctubbsii commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/228#discussion_r105253899
  
    --- Diff: 
minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
 ---
    @@ -123,11 +120,12 @@ public int exec(Class<?> clz, String[] args) throws 
IOException {
     
       public Entry<Integer,String> execMapreduceWithStdout(Class<?> clz, 
String[] args) throws IOException {
         String host = "localhost";
    -    String[] cmd = new String[3 + args.length];
    -    cmd[0] = getToolPath();
    -    cmd[1] = getJarFromClass(clz);
    -    cmd[2] = clz.getName();
    -    for (int i = 0, j = 3; i < args.length; i++, j++) {
    +    String[] cmd = new String[4 + args.length];
    +    cmd[0] = getAccumuloUtilPath();
    +    cmd[1] = "hadoop-jar";
    +    cmd[2] = getJarFromClass(clz);
    +    cmd[3] = clz.getName();
    +    for (int i = 0, j = 4; i < args.length; i++, j++) {
    --- End diff --
    
    This whole thing would be easier to read if it used ArrayList for cmd 
instead, and just appended to the end.
    At the very least, we could protect against mistakes here, by setting 
`offset = 4` and using that to construct the array size (`new String[offset + 
args.length]`) and in this loop:
    ```java
    for (int i = offset; i < args.length; i++) {
      cmd[i + offset] = "'" + args[i] + "'";
    }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to