Uploaded image for project: 'Thorntail'
  1. Thorntail
  2. THORN-607

StringIndexOutOfBoundsException: String index out of range: -1 during plugin JAR build

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Done
    • 1.0.0.Final
    • 2016.8
    • fraction-plugin
    • None

    Description

      Unable to use Swarm maven plugin when using Fraction auto detect mode force. Regression from Beta7 in at least one project. Swarm plugin section of POM looks like. Fraction and additional fractions can be added or removed, but result is the same so long as <fractionDetectMode>force</fractionDetectMode> is used.

      <configuration>
      <mainClass>com.myorg.swarm.SwarmMain</mainClass>
      <properties>
      <swarm.context.path>/my-root-context</swarm.context.path>
      </properties>
      <fractionDetectMode>force</fractionDetectMode>
      <fractions>
      <fraction>jaxrs-cdi</fraction>
      <fraction>undertow</fraction>
      <fraction>jpa</fraction>
      <fraction>ejb</fraction>
      <fraction>mail</fraction>
      </fractions>
      <additionalFractions>
      <additionalFraction>jaxrs-cdi</additionalFraction>
      <additionalFraction>undertow</additionalFraction>
      <additionalFraction>jpa</additionalFraction>
      <additionalFraction>ejb</additionalFraction>
      <additionalFraction>mail</additionalFraction>
      </additionalFractions>
      </configuration>
      </plugin>

      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.wildfly.swarm:wildfly-swarm-plugin:1.0.0.Final:package (default) on project sam-war: Unable to create -swarm.jar

      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)

      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)

      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)

      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)

      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)

      at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)

      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)

      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)

      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)

      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)

      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)

      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)

      at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:497)

      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)

      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)

      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)

      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

      Caused by: org.apache.maven.plugin.MojoFailureException: Unable to create -swarm.jar

      at org.wildfly.swarm.plugin.maven.PackageMojo.execute(PackageMojo.java:138)

      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)

      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)

      ... 20 more

      Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1

      at java.lang.String.substring(String.java:1955)

      at org.wildfly.swarm.tools.FractionUsageAnalyzer.asClassNameMatch(FractionUsageAnalyzer.java:86)

      at org.wildfly.swarm.tools.FractionUsageAnalyzer$$Lambda$54/412497692.apply(Unknown Source)

      at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)

      at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1540)

      at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512)

      at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502)

      at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)

      at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)

      at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)

      at org.wildfly.swarm.tools.FractionUsageAnalyzer.detectNeededFractions(FractionUsageAnalyzer.java:63)

      at org.wildfly.swarm.tools.BuildTool.detectFractions(BuildTool.java:242)

      at org.wildfly.swarm.tools.BuildTool.addWildflySwarmBootstrapJar(BuildTool.java:303)

      at org.wildfly.swarm.tools.BuildTool.build(BuildTool.java:177)

      at org.wildfly.swarm.tools.BuildTool.build(BuildTool.java:171)

      at org.wildfly.swarm.plugin.maven.PackageMojo.execute(PackageMojo.java:121)

      ... 22 more

      Attachments

        Activity

          People

            bmcwhirt@redhat.com Bob McWhirter (Inactive)
            jhovell_jira John Hovell (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: