Review Board 1.7.22


In-process Hive CLI driver does not work

Review Request #7143 - Created Sept. 18, 2012 and submitted

David Robson
trunk
SQOOP-607
Reviewers
Sqoop
sqoop-trunk
Throw the exception from the old namespace to support anyone checking the old exception. Also update HiveImport to check the new namespace.
Created a mock Hive CLI that calls System.exit(0). Can see it now works.
Was trying to create an automated test but the problem was once I created the mock class it was used for the other tests as well instead of the shell script.
The easiest way I can see to create a unit test would be to allow the Hive CLI class to be specified as a parameter - that way it could be overridden in a unit test to a mock class.
Was also thinking about loading the class at runtime but this seemed like a bit of work for a small bug fix.

Diff revision 2 (Latest)

1 2
1 2

  1. src/java/org/apache/sqoop/util/SubprocessSecurityManager.java: Loading...
src/java/org/apache/sqoop/util/SubprocessSecurityManager.java
Revision 4951627 New Change
[20] 77 lines
[+20] [+] public void uninstall() {
78
   * Disallow the capability to call System.exit() or otherwise
78
   * Disallow the capability to call System.exit() or otherwise
79
   * terminate the JVM.
79
   * terminate the JVM.
80
   */
80
   */
81
  public void checkExit(int status) {
81
  public void checkExit(int status) {
82
    LOG.debug("Rejecting System.exit call with status=" + status);
82
    LOG.debug("Rejecting System.exit call with status=" + status);
83
    throw new ExitSecurityException(status);
83
    throw new com.cloudera.sqoop.util.ExitSecurityException(status);
84
  }
84
  }
85

    
   
85

   
86
  @Override
86
  @Override
87
  /**
87
  /**
88
   * Check a particular permission. Checks with this SecurityManager
88
   * Check a particular permission. Checks with this SecurityManager
[+20] [20] 17 lines
  1. src/java/org/apache/sqoop/util/SubprocessSecurityManager.java: Loading...