Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-3854

java.lang.StringIndexOutOfBoundsException is thrown when generating sources for a WADL with WADL2Java Maven plugin

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5
    • 2.5, 2.4.4
    • Apache Maven 2.2.1 (rdebian-4)
      Java version: 1.6.0_26
      Java home: /usr/lib/jvm/java-6-sun-1.6.0.26/jre
      Default locale: en_US, platform encoding: UTF-8
      OS name: "linux" version: "2.6.38-11-generic" arch: "amd64" Family: "unix"

    • Unknown

    Description

      I want to create the client stubs with a .wadl file.
      Before you ask, it's not possible for me to attach the file due to an NDA.

      Important:
      It works fine, if I don't use the <extraarg>-impl</extraarg> extraarg.

      This is the maven plugin definition in the pom.xml file:

       
      <plugin>
          <groupId>org.apache.cxf</groupId>
          <artifactId>cxf-wadl2java-plugin</artifactId>
          <!-- version>2.4.1</version -->
          <version>2.5.0-SNAPSHOT</version>
          <executions>
                  <execution>
                          <id>generate-sources</id>
                          <phase>generate-sources</phase>
                          <configuration>
                                  <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
                                  <wadlOptions>
                                          <wadlOption>
                                                  <wadl>${basedir}/src/main/resources/wadl/myWadlFile.wadl</wadl>
                                                  <!-- impl>true</impl -->
                                                  <packagename>org.apache.cxf.systest.jaxrs.codegen.service</packagename>
                                                  <schemaPackagenames>
                                                          <schemaPackagename>http://MYPACKNAME=org.apache.cxf.systest.jaxrs.codegen.schema</schemaPackagename>
                                                  </schemaPackagenames>
                                                  <extraargs>
                                                          <extraarg>-impl</extraarg>
                                                          <extraarg>-interface</extraarg>
                                                          <extraarg>-verbose</extraarg>
                                                  </extraargs>
                                          </wadlOption>
                                  </wadlOptions>
                          </configuration>
                          <goals>
                                  <goal>wadl2java</goal>
                          </goals>
                  </execution>
          </executions>
      </plugin>
      

      Then, after calling mvn clean generate-sources, I get this exception:

      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] java.lang.StringIndexOutOfBoundsException: String index out of range: 0
      
      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      org.apache.maven.lifecycle.LifecycleExecutionException: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
      	at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      	at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      	at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      	at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      Caused by: org.apache.maven.plugin.MojoExecutionException: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
      	at org.apache.cxf.maven_plugin.wadlto.AbstractCodeGeneratorMojo.callCodeGenerator(AbstractCodeGeneratorMojo.java:458)
      	at org.apache.cxf.maven_plugin.wadlto.WADL2JavaMojo.execute(WADL2JavaMojo.java:101)
      	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
      	... 17 more
      Caused by: org.apache.cxf.tools.common.ToolException: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
      	at org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.execute(JAXRSContainer.java:84)
      	at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
      	at org.apache.cxf.tools.wadlto.WADLToJava.run(WADLToJava.java:65)
      	at org.apache.cxf.tools.wadlto.WADLToJava.run(WADLToJava.java:57)
      	at org.apache.cxf.maven_plugin.wadlto.AbstractCodeGeneratorMojo.callCodeGenerator(AbstractCodeGeneratorMojo.java:455)
      	... 20 more
      Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
      	at java.lang.String.charAt(String.java:686)
      	at org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.getClassName(SourceGenerator.java:432)
      	at org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.writeResourceMethod(SourceGenerator.java:595)
      	at org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.writeMethods(SourceGenerator.java:474)
      	at org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.writeResourceClass(SourceGenerator.java:381)
      	at org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.generateResourceClasses(SourceGenerator.java:234)
      	at org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.generateSource(SourceGenerator.java:201)
      	at org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.processWadl(JAXRSContainer.java:144)
      	at org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.execute(JAXRSContainer.java:67)
      	at org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.execute(JAXRSContainer.java:76)
      	... 24 more
      

      Attachments

        1. logging.properties
          0.2 kB
          Sergey Beryozkin
        2. patch.txt
          10 kB
          Lars Weber

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            sergey_beryozkin Sergey Beryozkin
            particle Lars Weber
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment