Merge pull request #915 from broadinstitute/yf_fix_missing_filename_in_error
added the missing file to the error message
This commit is contained in:
commit
7cc802f3d0
|
|
@ -428,4 +428,64 @@ public class SelectVariantsIntegrationTest extends WalkerTest {
|
||||||
);
|
);
|
||||||
executeTest(String.format("testUnusedAlleleTrimming: (%s,%s)", new File(vcf).getName(), extraArgs), spec);
|
executeTest(String.format("testUnusedAlleleTrimming: (%s,%s)", new File(vcf).getName(), extraArgs), spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test with an empty VCF file
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testEmptyVcfException(){
|
||||||
|
String testfile = privateTestDir + "reallyEmpty.vcf";
|
||||||
|
|
||||||
|
WalkerTestSpec spec = new WalkerTestSpec(
|
||||||
|
"-T SelectVariants" +
|
||||||
|
" -R " + b36KGReference +
|
||||||
|
" -V " + testfile +
|
||||||
|
" -o %s --no_cmdline_in_header",
|
||||||
|
1,
|
||||||
|
UserException.CommandLineException.class
|
||||||
|
);
|
||||||
|
spec.disableShadowBCF();
|
||||||
|
|
||||||
|
executeTest("testEmptyVcfException--" + testfile, spec);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test with a VCF file that is not a file
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testNotFileVcfException(){
|
||||||
|
String testfile = privateTestDir;
|
||||||
|
|
||||||
|
WalkerTestSpec spec = new WalkerTestSpec(
|
||||||
|
"-T SelectVariants" +
|
||||||
|
" -R " + b36KGReference +
|
||||||
|
" -V " + testfile +
|
||||||
|
" -o %s --no_cmdline_in_header",
|
||||||
|
1,
|
||||||
|
UserException.CouldNotReadInputFile.class
|
||||||
|
);
|
||||||
|
spec.disableShadowBCF();
|
||||||
|
|
||||||
|
executeTest("testNotFileVcfException--" + testfile, spec);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test with a VCF file that does not exist
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testMissingVcfException(){
|
||||||
|
String testfile = "test.vcf";
|
||||||
|
|
||||||
|
WalkerTestSpec spec = new WalkerTestSpec(
|
||||||
|
"-T SelectVariants" +
|
||||||
|
" -R " + b36KGReference +
|
||||||
|
" -V " + testfile +
|
||||||
|
" -o %s --no_cmdline_in_header",
|
||||||
|
1,
|
||||||
|
UserException.CouldNotReadInputFile.class
|
||||||
|
);
|
||||||
|
spec.disableShadowBCF();
|
||||||
|
|
||||||
|
executeTest("testMissingVcfException--" + testfile, spec);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,13 @@
|
||||||
package org.broadinstitute.gatk.utils.commandline;
|
package org.broadinstitute.gatk.utils.commandline;
|
||||||
|
|
||||||
import htsjdk.tribble.AbstractFeatureReader;
|
import htsjdk.tribble.AbstractFeatureReader;
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import htsjdk.tribble.Feature;
|
import htsjdk.tribble.Feature;
|
||||||
import org.broadinstitute.gatk.utils.refdata.tracks.FeatureManager;
|
import org.apache.log4j.Logger;
|
||||||
import org.broadinstitute.gatk.utils.classloader.JVMUtils;
|
import org.broadinstitute.gatk.utils.classloader.JVMUtils;
|
||||||
import org.broadinstitute.gatk.utils.exceptions.DynamicClassResolutionException;
|
import org.broadinstitute.gatk.utils.exceptions.DynamicClassResolutionException;
|
||||||
import org.broadinstitute.gatk.utils.exceptions.ReviewedGATKException;
|
import org.broadinstitute.gatk.utils.exceptions.ReviewedGATKException;
|
||||||
import org.broadinstitute.gatk.utils.exceptions.UserException;
|
import org.broadinstitute.gatk.utils.exceptions.UserException;
|
||||||
|
import org.broadinstitute.gatk.utils.refdata.tracks.FeatureManager;
|
||||||
import org.broadinstitute.gatk.utils.text.XReadLines;
|
import org.broadinstitute.gatk.utils.text.XReadLines;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
@ -396,13 +396,13 @@ public abstract class ArgumentTypeDescriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! file.exists() ) {
|
if ( ! file.exists() ) {
|
||||||
throw new UserException.CouldNotReadInputFile(file, "file does not exist");
|
throw new UserException.CouldNotReadInputFile(file, "file \'"+ file + "\' does not exist");
|
||||||
} else if ( ! file.canRead() || ! file.isFile() ) {
|
} else if ( ! file.canRead() || ! file.isFile() ) {
|
||||||
throw new UserException.CouldNotReadInputFile(file, "file could not be read");
|
throw new UserException.CouldNotReadInputFile(file, "file \'"+ file + "\' could not be read");
|
||||||
} else {
|
} else {
|
||||||
throw new UserException.CommandLineException(
|
throw new UserException.CommandLineException(
|
||||||
String.format("No tribble type was provided on the command line and the type of the file could not be determined dynamically. " +
|
String.format("No tribble type was provided on the command line and the type of the file \'"+ file + "\' could not be determined dynamically. " +
|
||||||
"Please add an explicit type tag :NAME listing the correct type from among the supported types:%n%s",
|
"Please add an explicit type tag :NAME listing the correct type from among the supported types:%n%s",
|
||||||
manager.userFriendlyListOfAvailableFeatures(parameterType)));
|
manager.userFriendlyListOfAvailableFeatures(parameterType)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue