You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Zheng Feng (Jira)" <ji...@apache.org> on 2019/10/18 03:35:00 UTC

[jira] [Created] (CAMEL-14081) camel-api-component-maven-plugin fromApis throw java.lang.StringIndexOutOfBoundsException

Zheng Feng created CAMEL-14081:
----------------------------------

             Summary: camel-api-component-maven-plugin fromApis throw java.lang.StringIndexOutOfBoundsException
                 Key: CAMEL-14081
                 URL: https://issues.apache.org/jira/browse/CAMEL-14081
             Project: Camel
          Issue Type: Bug
          Components: camel-as2, tooling
    Affects Versions: 2.24.2
            Reporter: Zheng Feng
            Assignee: Zheng Feng


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
{noformat}
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)

{noformat}

I think it is related to JavaDocParser in the camel-api-component-maven-plugin 
{code:java}
if (title != null) {
    // append package name to type name text
    methodTextBuilder.append(title.substring(title.lastIndexOf(' '))).append('.');
}
{code}

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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)