[ 
https://jira.codehaus.org/browse/JIBX-474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=294131#comment-294131
 ] 

srini commented on JIBX-474:
----------------------------

Encountered similar NullPointerException when <xs:list 
itemType="enumerationtype"> definition like below, jibx version 1.2.3:

<xs:sequence>
     <xs:element name="SKUs" type="EnumList"/>
<xs:sequence>

<xs:simpleType name="EnumList">
    <xs:list itemType="EnumType"/>
</xs:simpleType>

<xs:simpleType name="EnumType">
  <xs:restriction base="xs:string">
      <xs:enumeration value="dnum1"/>
      <xs:enumeration value="enum2"/>
  </xs:restriction>
<xs:simpleType>





                
> NullPointerException in CodeGen for <xs:list itemType="xs:int" />
> -----------------------------------------------------------------
>
>                 Key: JIBX-474
>                 URL: https://jira.codehaus.org/browse/JIBX-474
>             Project: JiBX
>          Issue Type: Bug
>          Components: CodeGen
>    Affects Versions: JiBX 1.2.3
>         Environment: Windows 7, maven 3.0.4, JiBX 1.2.3
>            Reporter: Klaus Claszen
>         Attachments: jibx-list-codegen-test.zip
>
>
> I tried to generate code for the following XSD schema using the 
> jibx-maven-plugin version 1.2.3:
> {code}
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
> xmlns:tns="http://foo.bar";
>       elementFormDefault="qualified" targetNamespace="http://foo.bar";>
>       <xs:simpleType name="idList">
>               <xs:list itemType="xs:int" />
>       </xs:simpleType>
>       <xs:complexType name="request">
>               <xs:sequence>
>                       <xs:element name="time" type="xs:dateTime" minOccurs="0"
>                               maxOccurs="1" />
>               </xs:sequence>
>               <xs:attribute name="knownIds" type="tns:idList" />
>       </xs:complexType>
> </xs:schema>
> {code}
> this results in the following error message
> {code}
> [ERROR] Failed to execute goal 
> org.jibx:jibx-maven-plugin:1.2.3:schema-codegen 
> (generate-java-code-from-schema) on proje
> ct jibx-list-codegen-test: null: MojoExecutionException: NullPointerException 
> -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute 
> goal org.jibx:jibx-maven-plugin:1.2.3:schema-c
> odegen (generate-java-code-from-schema) on project jibx-list-codegen-test: 
> null
>         at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
>         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:84)
>         at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
>         at 
> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
>         at 
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
>         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
>         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
>         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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
>         at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
>         at 
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
>         at 
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
> Caused by: org.apache.maven.plugin.MojoExecutionException
>         at 
> org.jibx.maven.AbstractCodeGenMojo.execute(AbstractCodeGenMojo.java:274)
>         at 
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
>         at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>         ... 19 more
> Caused by: java.lang.NullPointerException
>         at 
> org.jibx.schema.codegen.SourceBuilder.finish(SourceBuilder.java:327)
>         at 
> org.jibx.schema.codegen.PackageHolder.generate(PackageHolder.java:211)
>         at 
> org.jibx.schema.codegen.PackageHolder.generate(PackageHolder.java:227)
>         at org.jibx.schema.codegen.CodeGen.buildDataModel(CodeGen.java:1572)
>         at org.jibx.schema.codegen.CodeGen.generate(CodeGen.java:1779)
>         at org.jibx.schema.codegen.CodeGen.main(CodeGen.java:2202)
>         at 
> org.jibx.maven.AbstractCodeGenMojo.execute(AbstractCodeGenMojo.java:271)
>         ... 21 more
> {code}
> If I change the xs:list itemType to string ({{<xs:list itemType="xs:string" 
> />}}) everything works well.
> If I use other types (e.g. {{"xs:double"}}) I get an {{"Internal error - 
> invalid list type"}} although the type seems to be supported (I looked at 
> [BuiltinFormats.java|http://grepcode.com/file_/repo1.maven.org/maven2/org.jibx/jibx-bind/1.2.3/org/jibx/binding/model/BuiltinFormats.java/?v=source]
>  - not sure if this is the right place).
> So my main issue is to get {{<xs:list itemType="xs:int" />}} working in code 
> generation but I also wonder what list types are supported.
> Thanks for any help!
> Regards
>   Klaus
> PS: Maven test project included as attachment.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
jibx-devs mailing list
jibx-devs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to