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

This commit is contained in:
Vinayakumar B 2015-10-07 14:29:34 +05:30
parent 3112f26368
commit 61b3547c46
3 changed files with 16 additions and 0 deletions

View File

@ -1971,6 +1971,9 @@ Release 2.8.0 - UNRELEASED
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
INCOMPATIBLE CHANGES

View File

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

View File

@ -341,6 +341,15 @@ public class TestOfflineImageViewer {
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)
throws IOException, InterruptedException {
final String DELIMITER = "\t";