jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • JiBX
  • JIBX-474

NullPointerException in CodeGen for <xs:list itemType="xs:int" />

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: JiBX 1.2.3
  • Fix Version/s: None
  • Component/s: CodeGen
  • Labels:
    None
  • Environment:
    Windows 7, maven 3.0.4, JiBX 1.2.3
  • Testcase included:
    yes

Description

I tried to generate code for the following XSD schema using the jibx-maven-plugin version 1.2.3:

<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>

this results in the following error message

[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

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 - 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.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Hide
    Zip Archive
    jibx-list-codegen-test.zip
    03/Feb/12 4:56 AM
    2 kB
    Klaus Claszen
    1. XML File
      jibx-list-codegen-test/pom.xml 2 kB
    2. XML File
      jibx-list-codegen-test/src/.../foobar.xsd 0.5 kB
    Download Zip
    Show
    Zip Archive
    jibx-list-codegen-test.zip
    03/Feb/12 4:56 AM
    2 kB
    Klaus Claszen

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
srini added a comment - 14/Mar/12 2:05 PM

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>

Show
srini added a comment - 14/Mar/12 2:05 PM 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>

People

  • Assignee:
    Unassigned
    Reporter:
    Klaus Claszen
Vote (0)
Watch (0)

Dates

  • Created:
    03/Feb/12 4:56 AM
    Updated:
    14/Mar/12 2:05 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.