Skip to content

[KARAF-7317] Support spaces in boot features path#1477

Merged
jbonofre merged 1 commit intoapache:mainfrom
jdmcmahan:encode-boot-feature-path
Jan 6, 2022
Merged

[KARAF-7317] Support spaces in boot features path#1477
jbonofre merged 1 commit intoapache:mainfrom
jdmcmahan:encode-boot-feature-path

Conversation

@jdmcmahan
Copy link
Copy Markdown

URI.create(String) throws a URISyntaxException if any of the resolved URIs from featuresRepositories contains a space.

This is common if customizing the boot features via the karaf-maven-plugin, then running the assembly from within a path containing spaces.

For example:

<plugin>
    <groupId>org.apache.karaf.tooling</groupId>
    <artifactId>karaf-maven-plugin</artifactId>
    <version>${karaf.version}</version>
    <configuration>
        <bootFeatures>
            <feature>standard</feature>
            <feature>my-feature</feature>
        </bootFeatures>
        ...
    </configuration>
</plugin>

will result in a new feature in etc as well as an entry in etc/org.apache.karaf.features.cfg:

featuresRepositories = file:${karaf.etc}/2b260482-45bc-427c-af65-8909c1f2f7a3.xml

However, if karaf.etc contains a space at runtime, Karaf fails to start because the URI cannot be parsed.

This PR simply replaces all spaces with %20 before passing the path to URI.create(String). The encodePath method can be further enhanced if other characters prove to be problematic.

@jdmcmahan jdmcmahan changed the title Support spaces in boot features path [KARAF-7317] Support spaces in boot features path Jan 5, 2022
@jdmcmahan
Copy link
Copy Markdown
Author

I have created a companion ticket at KARAF-7317.

@jbonofre jbonofre self-requested a review January 6, 2022 17:44
@jbonofre jbonofre merged commit 719f3f3 into apache:main Jan 6, 2022
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

Successfully merging this pull request may close these issues.

3 participants