Uploaded image for project: 'mdsal'
  1. mdsal
  2. MDSAL-651

yang-maven-plugin:6.0.2 error while generating sources

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Highest
    • Resolution: Done
    • Affects Version/s: 7.0.3
    • Fix Version/s: 7.0.4
    • Component/s: Binding V1 codegen
    • Labels:

      Description

      Hello,

      After upgrading yang-maven-plugin from 6.0.0 to 6.0.2, the
      generation of java classes failed for
      org-openroadm-device@2020-05-29.yang file.
      The following error is displayed:

      [ERROR] Failed to execute goal org.opendaylight.yangtools:yang-maven-plugin:6.0.2:generate-sources (binding) on project model-test: Execution binding of goal org.opendaylight.yangtools:yang-maven-plugin:6.0.2:generate-sources failed.: ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0 -> [Help 1]
       org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.opendaylight.yangtools:yang-maven-plugin:6.0.2:generate-sources (binding) on project model-test: Execution binding of goal org.opendaylight.yangtools:yang-maven-plugin:6.0.2:generate-sources failed.
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
       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:956)
       at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
       at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
       at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
       at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
       at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke (Method.java:566)
       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: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
       at org.opendaylight.mdsal.binding.java.api.generator.BuilderTemplate.generateSetter (BuilderTemplate.java:716)
       at org.opendaylight.mdsal.binding.java.api.generator.BuilderTemplate.generateSetters (BuilderTemplate.java:1054)
       at org.opendaylight.mdsal.binding.java.api.generator.BuilderTemplate.body (BuilderTemplate.java:154)
       at org.opendaylight.mdsal.binding.java.api.generator.BaseTemplate.generate (BaseTemplate.java:103)
       at org.opendaylight.mdsal.binding.java.api.generator.BuilderGenerator.generate (BuilderGenerator.java:59)
       at org.opendaylight.mdsal.binding.java.api.generator.GeneratorJavaFile$GeneratorStringSupplier.get (GeneratorJavaFile.java:52)
       at org.opendaylight.mdsal.binding.java.api.generator.GeneratorJavaFile$GeneratorStringSupplier.get (GeneratorJavaFile.java:41)
       at org.opendaylight.mdsal.binding.maven.api.gen.plugin.CodeGeneratorImpl$GenerationTask.generateFile (CodeGeneratorImpl.java:282)
       at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:195)
       at java.util.ArrayList$ArrayListSpliterator.forEachRemaining (ArrayList.java:1655)
       at com.google.common.collect.CollectSpliterators$FlatMapSpliterator.lambda$forEachRemaining$1 (CollectSpliterators.java:361)
       at java.util.HashMap$ValueSpliterator.forEachRemaining (HashMap.java:1675)
       at com.google.common.collect.CollectSpliterators$FlatMapSpliterator.forEachRemaining (CollectSpliterators.java:357)
       at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:484)
       at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:474)
       at java.util.stream.ReduceOps$ReduceTask.doLeaf (ReduceOps.java:952)
       at java.util.stream.ReduceOps$ReduceTask.doLeaf (ReduceOps.java:926)
       at java.util.stream.AbstractTask.compute (AbstractTask.java:327)
       at java.util.concurrent.CountedCompleter.exec (CountedCompleter.java:746)
       at java.util.concurrent.ForkJoinTask.doExec (ForkJoinTask.java:290)
       at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec (ForkJoinPool.java:1020)
       at java.util.concurrent.ForkJoinPool.scan (ForkJoinPool.java:1656)
       at java.util.concurrent.ForkJoinPool.runWorker (ForkJoinPool.java:1594)
       at java.util.concurrent.ForkJoinWorkerThread.run (ForkJoinWorkerThread.java:183)

      The problem seems located in
      leaf-list port-list {
      type leafref

      { path "/org-openroadm-device/circuit-packs[circuit-pack-name=current()/../circuit-pack-name]/ports/port-name"; }

      description
      "port list";
      }

      When generating setter, the object returnType is an empty List and
      does not contain the type of the objects in the list portList.
      Trace from remote debug:
      MethodSignatureImpl [name=getPortList,
      comment=TypeMemberComment

      {reference=port list}

      ,
      definingType=org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.supporting.circuit.pack.list.grp.SupportingPortList,
      returnType=Type (java.util.List), params=[], annotations=[]]

      I’ve attached a sample to reproduce the problem and the output log of
      the maven command.

      Thanks in advance for your help

        Attachments

        1. output.log
          592 kB
        2. sample.tgz
          56 kB

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              rovarga Robert Varga
              Reporter:
              manuedelf Emmanuelle Delfour
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: