castor

NullPointerException for an extended type with xs:any

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.1
  • Fix Version/s: 1.1.1
  • Component/s: General
  • Labels:
    None
  • Environment:
    Windows xp
  • Testcase included:
    yes
  • Number of attachments :
    2

Description

I encountered a null pointer exception when using the source generator ant task to generate java files for an xsd schema. The error seems to occur whenever a complex type that extends another type contains an xs:any element. I have attached a sample schema to demonstrate. When processed, the following stack trace occurs:

java.lang.NullPointerException
at org.castor.anttask.CastorCodeGenTask.processFile(CastorCodeGenTask.java:424)
at org.castor.anttask.CastorCodeGenTask.execute(CastorCodeGenTask.java:470)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: java.lang.NullPointerException
at org.castor.anttask.CastorCodeGenTask$CastorSourceGeneratorWrapper.generateSource(CastorCodeGenTask.java:557)
at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:503)
at org.castor.anttask.CastorCodeGenTask.processFile(CastorCodeGenTask.java:418)
... 13 more
Caused by: java.lang.NullPointerException
at org.exolab.castor.builder.SourceFactory.handleField(SourceFactory.java:1946)
at org.exolab.castor.builder.SourceFactory.processContentModel(SourceFactory.java:1837)
at org.exolab.castor.builder.SourceFactory.processContentModel(SourceFactory.java:1805)
at org.exolab.castor.builder.SourceFactory.processComplexType(SourceFactory.java:1725)
at org.exolab.castor.builder.SourceFactory.processComplexType(SourceFactory.java:646)
at org.exolab.castor.builder.SourceFactory.createSourceCode(SourceFactory.java:342)
at org.exolab.castor.builder.SourceGenerator.processComplexType(SourceGenerator.java:899)
at org.exolab.castor.builder.SourceGenerator.generateAllClassFiles(SourceGenerator.java:694)
at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:655)
at org.castor.anttask.CastorCodeGenTask$CastorSourceGeneratorWrapper.generateSource(CastorCodeGenTask.java:555)
... 15 more
— Nested Exception —
java.lang.NullPointerException
at org.castor.anttask.CastorCodeGenTask$CastorSourceGeneratorWrapper.generateSource(CastorCodeGenTask.java:557)
at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:503)
at org.castor.anttask.CastorCodeGenTask.processFile(CastorCodeGenTask.java:418)
at org.castor.anttask.CastorCodeGenTask.execute(CastorCodeGenTask.java:470)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: java.lang.NullPointerException
at org.exolab.castor.builder.SourceFactory.handleField(SourceFactory.java:1946)
at org.exolab.castor.builder.SourceFactory.processContentModel(SourceFactory.java:1837)
at org.exolab.castor.builder.SourceFactory.processContentModel(SourceFactory.java:1805)
at org.exolab.castor.builder.SourceFactory.processComplexType(SourceFactory.java:1725)
at org.exolab.castor.builder.SourceFactory.processComplexType(SourceFactory.java:646)
at org.exolab.castor.builder.SourceFactory.createSourceCode(SourceFactory.java:342)
at org.exolab.castor.builder.SourceGenerator.processComplexType(SourceGenerator.java:899)
at org.exolab.castor.builder.SourceGenerator.generateAllClassFiles(SourceGenerator.java:694)
at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:655)
at org.castor.anttask.CastorCodeGenTask$CastorSourceGeneratorWrapper.generateSource(CastorCodeGenTask.java:555)
... 15 more
— Nested Exception —
java.lang.NullPointerException
at org.exolab.castor.builder.SourceFactory.handleField(SourceFactory.java:1946)
at org.exolab.castor.builder.SourceFactory.processContentModel(SourceFactory.java:1837)
at org.exolab.castor.builder.SourceFactory.processContentModel(SourceFactory.java:1805)
at org.exolab.castor.builder.SourceFactory.processComplexType(SourceFactory.java:1725)
at org.exolab.castor.builder.SourceFactory.processComplexType(SourceFactory.java:646)
at org.exolab.castor.builder.SourceFactory.createSourceCode(SourceFactory.java:342)
at org.exolab.castor.builder.SourceGenerator.processComplexType(SourceGenerator.java:899)
at org.exolab.castor.builder.SourceGenerator.generateAllClassFiles(SourceGenerator.java:694)
at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:655)
at org.castor.anttask.CastorCodeGenTask$CastorSourceGeneratorWrapper.generateSource(CastorCodeGenTask.java:555)
at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:503)
at org.castor.anttask.CastorCodeGenTask.processFile(CastorCodeGenTask.java:418)
at org.castor.anttask.CastorCodeGenTask.execute(CastorCodeGenTask.java:470)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)

  1. EntitiesTest.xsd
    06/Apr/07 7:20 AM
    0.7 kB
    Dave Hauver
  2. patch.c1938.20070406.txt
    06/Apr/07 7:59 AM
    2 kB
    Werner Guttmann

Issue Links

Activity

Hide
Werner Guttmann added a comment -

Thanks, Dave, we'll be looking into this. Just out of curiosity, is this something that just occurred to you for the first time, or is this a result of e.g. upgrading from an old release. I am just trying to get an idea of the context.

Show
Werner Guttmann added a comment - Thanks, Dave, we'll be looking into this. Just out of curiosity, is this something that just occurred to you for the first time, or is this a result of e.g. upgrading from an old release. I am just trying to get an idea of the context.
Hide
Dave Hauver added a comment -

This is the first time I've used Castor, so version 1.1 is the only one I have tried this with.

Show
Dave Hauver added a comment - This is the first time I've used Castor, so version 1.1 is the only one I have tried this with.
Hide
Werner Guttmann added a comment -

Patch for review. This basically removes all NPEs from the code generation run, and the CTF still completes. Having said that, would you have a minimal XML document instance that matched that schema, to ease our life to get a new CTF test integrated ?

Show
Werner Guttmann added a comment - Patch for review. This basically removes all NPEs from the code generation run, and the CTF still completes. Having said that, would you have a minimal XML document instance that matched that schema, to ease our life to get a new CTF test integrated ?

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: