Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-14081

camel-api-component-maven-plugin fromApis throw java.lang.StringIndexOutOfBoundsException

    XMLWordPrintableJSON

Details

    • Unknown

    Description

      I find this issue as my locale environment is zh_CN.UTF-8 and the javadoc generate the "lang=zh" html files. And this causes the following exception

      java.lang.StringIndexOutOfBoundsException: String index out of range: -1
      	at java.lang.String.substring(String.java:1927)
      	at org.apache.camel.maven.JavadocParser.startTag(JavadocParser.java:115)
      	at javax.swing.text.html.parser.Parser.parseTag(Parser.java:1956)
      	at javax.swing.text.html.parser.Parser.parseContent(Parser.java:2097)
      	at javax.swing.text.html.parser.Parser.parse(Parser.java:2271)
      	at org.apache.camel.maven.JavadocApiMethodGeneratorMojo.getSignatureList(JavadocApiMethodGeneratorMojo.java:101)
      	at org.apache.camel.maven.AbstractApiMethodGeneratorMojo.execute(AbstractApiMethodGeneratorMojo.java:70)
      	at org.apache.camel.maven.ApiComponentGeneratorMojo.execute(ApiComponentGeneratorMojo.java:92)
      	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
      	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
      	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
      	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:954)
      	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
      	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:498)
      	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)
      
      

      I think it is related to JavaDocParser in the camel-api-component-maven-plugin

      if (title != null) {
          // append package name to type name text
          methodTextBuilder.append(title.substring(title.lastIndexOf(' '))).append('.');
      }
      

      This assumes that the java html doc is generated by English language. The workaround could be set "LANG=en_US.UTF-8" when running the maven build. In the other hand, I think it could add "<locale>en</locale>" in the javadoc configuration as we have to depend on the html files. This would effect the camel-as2, camel-linkedin, camel-box, camel-fhir, camel-olingo2 and camel-olingo4.

      Attachments

        Activity

          People

            zhfeng Zheng Feng
            zhfeng Zheng Feng
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m