Review Board 1.7.22


SQOOP-1212 Do not print usage on wrong command line

Review Request #14521 - Created Oct. 7, 2013 and updated

Jarek Cecho
SQOOP-1212
Reviewers
Sqoop
sqoop-trunk
I've removed the code responsible for printing out the usage on incorrect command line. This might be seen as backward incompatible change to some extent, however I believe that no external process should be depending on a usage printed out when incorrect command line is entered and therefore that this change should be fine. Please do not hesitate and let me know if there are any concerns about that!
1) Incomplete command line
[root@bousa-trunk ~]# sqoop import --table x
13/10/07 12:09:23 INFO sqoop.Sqoop: Running Sqoop version: 1.4.5-SNAPSHOT
Error: Required argument --connect is missing.
Try --help for usage instructions.
[root@bousa-trunk ~]#

2) Unknown command line argument
[root@bousa-trunk ~]# sqoop import --table x --xxx
13/10/07 12:09:36 INFO sqoop.Sqoop: Running Sqoop version: 1.4.5-SNAPSHOT
13/10/07 12:09:36 ERROR tool.BaseSqoopTool: Error parsing arguments for import:
13/10/07 12:09:36 ERROR tool.BaseSqoopTool: Unrecognized argument: --xxx

Try --help for usage instructions.

Diff revision 1 (Latest)

  1. src/java/org/apache/sqoop/Sqoop.java: Loading...
src/java/org/apache/sqoop/Sqoop.java
Revision 2addd62146029f862803fb0483da1b158bdd7a6e New Change
[20] 134 lines
[+20] [+] public int run(String [] args) {
135
      // Couldn't parse arguments.
135
      // Couldn't parse arguments.
136
      // Log the stack trace for this exception
136
      // Log the stack trace for this exception
137
      LOG.debug(e.getMessage(), e);
137
      LOG.debug(e.getMessage(), e);
138
      // Print exception message.
138
      // Print exception message.
139
      System.err.println(e.getMessage());
139
      System.err.println(e.getMessage());
140
      // Print the tool usage message and exit.

   
141
      ToolOptions toolOpts = new ToolOptions();

   
142
      tool.configureOptions(toolOpts);

   
143
      tool.printHelp(toolOpts);

   
144
      return 1; // Exit on exception here.
140
      return 1; // Exit on exception here.
145
    }
141
    }
146

    
   
142

   
147
    return tool.run(options);
143
    return tool.run(options);
148
  }
144
  }
[+20] [20] 96 lines
  1. src/java/org/apache/sqoop/Sqoop.java: Loading...