Review Board 1.7.22


SQOOP-880 Sqoop2: NPE when stopping job that was never executed

Review Request #9391 - Created Feb. 9, 2013 and submitted

Jarek Cecho
SQOOP-880
Reviewers
Sqoop
sqoop-sqoop2
I've fixed the NPE by adding explicit check.

 
core/src/main/java/org/apache/sqoop/framework/FrameworkManager.java
Revision 6aab2db49e55c3152149d61f29dcf8d8a3f95ba5 New Change
[20] 522 lines
[+20] [+] private void destroySubmission(SubmissionRequest request) {
523

    
   
523

   
524
  public MSubmission stop(long jobId) {
524
  public MSubmission stop(long jobId) {
525
    Repository repository = RepositoryManager.getInstance().getRepository();
525
    Repository repository = RepositoryManager.getInstance().getRepository();
526
    MSubmission submission = repository.findSubmissionLastForJob(jobId);
526
    MSubmission submission = repository.findSubmissionLastForJob(jobId);
527

    
   
527

   
528
    if(!submission.getStatus().isRunning()) {
528
    if(submission != null && !submission.getStatus().isRunning()) {
529
      throw new SqoopException(FrameworkError.FRAMEWORK_0003,
529
      throw new SqoopException(FrameworkError.FRAMEWORK_0003,
530
        "Job with id " + jobId + " is not running");
530
        "Job with id " + jobId + " is not running");
531
    }
531
    }
532

    
   
532

   
533
    String externalId = submission.getExternalId();
533
    String externalId = submission.getExternalId();
[+20] [20] 100 lines
  1. core/src/main/java/org/apache/sqoop/framework/FrameworkManager.java: Loading...