Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty system variables for file paths in @Sources cause URISyntaxException failures #226

Closed
jonn-smith opened this issue Apr 9, 2018 · 0 comments

Comments

@jonn-smith
Copy link
Contributor

@jonn-smith jonn-smith commented Apr 9, 2018

When using a variable in the @Sources annotation for a file path, if that variable is empty / undefined a URISyntaxException is thrown.

This is because of the resulting call to the URI constructor:

new URI("file:")

However, this produces an empty, non-null URI and is equivalent:

new URI("")

The logic in ConfigURIFactory::newURI should be updated to allow for this case.

==========

My example is below.

If BasicTestConfigWithClassPathOverridesAndVariableFile.pathToGatkConfig is not defined as a system variable, then at ConfigURIFactory.java:44 a URISyntaxException is thrown.

/**
 * Simple test configuration file to check overrides and other configuration features.
 */
@Config.LoadPolicy(Config.LoadType.MERGE)
@Config.Sources({
        "file:${" + BasicTestConfigWithClassPathOverridesAndVariableFile.CONFIG_FILE_VARIABLE_FILE_NAME + "}",
        "file:/etc/jaiow",                          // Test of non-existent bad path
        "classpath:org/broadinstitute/hellbender/utils/config/BasicTestConfigWithClassPathOverrides.properties",
})
public interface BasicTestConfigWithClassPathOverridesAndVariableFile extends Mutable, Accessible {
    String CONFIG_FILE_VARIABLE_FILE_NAME = "BasicTestConfigWithClassPathOverridesAndVariableFile.pathToGatkConfig";

    @DefaultValue("true")
    boolean booleanDefTrue();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant