diff --git a/src/main/java/picard/util/BedToIntervalList.java b/src/main/java/picard/util/BedToIntervalList.java index f3b7ff2e43..375e55df88 100644 --- a/src/main/java/picard/util/BedToIntervalList.java +++ b/src/main/java/picard/util/BedToIntervalList.java @@ -119,7 +119,7 @@ public class BedToIntervalList extends CommandLineProgram { protected int doWork() { IOUtil.assertFileIsReadable(INPUT); if(INPUT.getPath().equals("/dev/stdin")) { - throw new IllegalArgumentException("BedToIntervalList cannot read from /dev/stdin."); + throw new IllegalArgumentException("BedToIntervalList does not support reading from standard input - a file must be provided."); } IOUtil.assertFileIsReadable(SEQUENCE_DICTIONARY); diff --git a/src/test/java/picard/util/BedToIntervalListTest.java b/src/test/java/picard/util/BedToIntervalListTest.java index 3727f3973f..67b1c635f5 100644 --- a/src/test/java/picard/util/BedToIntervalListTest.java +++ b/src/test/java/picard/util/BedToIntervalListTest.java @@ -61,6 +61,18 @@ public void testLengthZeroIntervalsSkipped(final String inputBed) throws IOExcep doTest(inputBed, "header.sam", false); } + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRejectStdin() throws IOException { + final BedToIntervalList program = new BedToIntervalList(); + final File outputFile = File.createTempFile("bed_to_interval_list_test.", ".interval_list"); + outputFile.deleteOnExit(); + program.OUTPUT = outputFile; + program.SEQUENCE_DICTIONARY = new File(TEST_DATA_DIR, "header.sam"); + program.UNIQUE = true; + program.INPUT = new File("/dev/stdin"); + program.doWork(); + } + @DataProvider public Object[][] testBedToIntervalListDataProvider() { return new Object[][]{