Review Board 1.7.22


SQOOP-851 Sqoop2: NullPointerException in Mapreduce Submission engine initialization

Review Request #9076 - Created Jan. 23, 2013 and submitted

Jarek Cecho
SQOOP-851
Reviewers
Sqoop
sqoop-sqoop2
Problem is that method File.list() in java might return null in addition to empty array. I've add simple check that will throw more informative exception in case that configuration path is not valid.
Unit tests seems to be passing and I've tested simple import on real cluster.

Diff revision 1

This is not the most recent revision of the diff. The latest diff is revision 2. See what's changed.

1 2
1 2

  1. submission/mapreduce/src/main/java/org/apache/sqoop/submission/mapreduce/MapreduceSubmissionEngine.java: Loading...
submission/mapreduce/src/main/java/org/apache/sqoop/submission/mapreduce/MapreduceSubmissionEngine.java
Revision 1a144d0 New Change
[20] 88 lines
[+20] [+] public void initialize(MapContext context, String prefix) {
89
      public boolean accept(File dir, String name) {
89
      public boolean accept(File dir, String name) {
90
        return name.endsWith("-site.xml");
90
        return name.endsWith("-site.xml");
91
      }
91
      }
92
    });
92
    });
93

    
   
93

   

    
   
94
    if(files == null) {

    
   
95
      throw new SqoopException(MapreduceSubmissionError.MAPREDUCE_0002,

    
   
96
        "Hadoop configuration files were not found on path " + configDirectory);

    
   
97
    }

    
   
98

   
94
    // Add each such file to our global configuration object
99
    // Add each such file to our global configuration object
95
    for (String file : files) {
100
    for (String file : files) {
96
      LOG.info("Found hadoop configuration file " + file);
101
      LOG.info("Found hadoop configuration file " + file);
97
      try {
102
      try {
98
        globalConfiguration.addResource(new File(configDirectory, file).toURI().toURL());
103
        globalConfiguration.addResource(new File(configDirectory, file).toURI().toURL());
[+20] [20] 290 lines
  1. submission/mapreduce/src/main/java/org/apache/sqoop/submission/mapreduce/MapreduceSubmissionEngine.java: Loading...