payara / ecosystem-support

Placeholder repository to handle community requests for the Payara Platform ecosystem tools
3 stars 2 forks source link

Infinite recursivity when using empty <relativePath> #12

Closed jflecomte closed 1 year ago

jflecomte commented 3 years ago

If a pom has a parent defined with an empty , the method PropertyResolver.getPropertyFromPom will recurse forever.

Example of such parent declaration:

    <parent>
        <groupId>org.apache</groupId>
        <artifactId>apache</artifactId>
        <version>23</version>
        <relativePath></relativePath>
    </parent>

Stack trace generated is:

---------------------------------------------------
Exception in thread "main" java.lang.StackOverflowError
        at java.io.InputStream.<init>(InputStream.java:45)
        at java.io.FileInputStream.<init>(FileInputStream.java:123)
        at fish.payara.maven.extensions.regex.activator.PropertyResolver.readMavenProject(PropertyResolver.java:181)
        at fish.payara.maven.extensions.regex.activator.PropertyResolver.getPropertyFromPom(PropertyResolver.java:148)
        at fish.payara.maven.extensions.regex.activator.PropertyResolver.getPropertyFromPom(PropertyResolver.java:173)
        at fish.payara.maven.extensions.regex.activator.PropertyResolver.getPropertyFromPom(PropertyResolver.java:173)
        at fish.payara.maven.extensions.regex.activator.PropertyResolver.getPropertyFromPom(PropertyResolver.java:173)
        at fish.payara.maven.extensions.regex.activator.PropertyResolver.getPropertyFromPom(PropertyResolver.java:173)
        at fish.payara.maven.extensions.regex.activator.PropertyResolver.getPropertyFromPom(PropertyResolver.java:173)
jflecomte commented 3 years ago

Solution is quite simple: In PropertyResolver.getPropertyFromPom, replace: if (relativePath != null) { with: if (!Strings.isNullOrEmpty(relativePath)) { (and add import com.google.common.base.Strings;)

fturizo commented 1 year ago

This issue was fixed by the linked PR, closing it.