HDFS-9159. [OIV] : return value of the command is not correct if invalid value specified in '-p (processor)' option (Contributed by nijel)

(cherry picked from commit 61b3547c46)
This commit is contained in:
Vinayakumar B 2015-10-07 14:29:34 +05:30
parent 960b19edf6
commit 2b6fe90764
3 changed files with 16 additions and 0 deletions

View File

@ -1160,6 +1160,9 @@ Release 2.8.0 - UNRELEASED
HDFS-9196. Fix TestWebHdfsContentLength. (Masatake Iwasaki via jing9) HDFS-9196. Fix TestWebHdfsContentLength. (Masatake Iwasaki via jing9)
HDFS-9159. [OIV] : return value of the command is not correct if invalid
value specified in "-p (processor)" option (nijel via vinayakumarb)
Release 2.7.2 - UNRELEASED Release 2.7.2 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -182,6 +182,10 @@ public class OfflineImageViewerPB {
writer.visit(new RandomAccessFile(inputFile, "r")); writer.visit(new RandomAccessFile(inputFile, "r"));
} }
break; break;
default:
System.err.println("Invalid processor specified : " + processor);
printUsage();
return -1;
} }
return 0; return 0;
} catch (EOFException e) { } catch (EOFException e) {

View File

@ -341,6 +341,15 @@ public class TestOfflineImageViewer {
new FileSystemTestHelper().getTestRootDir() + "/delimited.db"); new FileSystemTestHelper().getTestRootDir() + "/delimited.db");
} }
@Test
public void testInvalidProcessorOption() throws Exception {
int status =
OfflineImageViewerPB.run(new String[] { "-i",
originalFsimage.getAbsolutePath(), "-o", "-", "-p", "invalid" });
assertTrue("Exit code returned for invalid processor option is incorrect",
status != 0);
}
private void testPBDelimitedWriter(String db) private void testPBDelimitedWriter(String db)
throws IOException, InterruptedException { throws IOException, InterruptedException {
final String DELIMITER = "\t"; final String DELIMITER = "\t";