castor

NullPointerException on castor-codegen when no binding file in use

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.1.1
  • Component/s: XML code generator
  • Labels:
    None
  • Number of attachments :
    2

Description

I'm using the latest snapshot, 1.1.1-20070329.084439-9.

My test case does not use a binding file. When I run it, either through Maven, Ant, or a direct call to SourceGeneratorMain, it gets a NullPointerException. When I use SGM directly, I get the following stack trace:

java.lang.NullPointerException
at org.exolab.castor.builder.JClassRegistry.bind(JClassRegistry.java:140)
at org.exolab.castor.builder.FactoryState.<init>(FactoryState.java:138)
at org.exolab.castor.builder.SourceFactory.createSourceCode(SourceFactory.java:304)
at org.exolab.castor.builder.SourceGenerator.createClasses(SourceGenerator.java:876)
at org.exolab.castor.builder.SourceGenerator.generateAllClassFiles(SourceGenerator.java:740)
at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:691)
at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:634)
at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:532)
at org.exolab.castor.builder.SourceGeneratorMain.main(SourceGeneratorMain.java:295)

I looked at the code in JClassRegistry, and it wasn't checking to see whether a binding object was found, it just derefs it. I've attached a patch (not compiled) to resolve this.

  1. JClassRegistry.patch
    01/Apr/07 12:28 PM
    3 kB
    David M. Karr
  2. patch.c1928.20070401.txt
    01/Apr/07 1:13 PM
    3 kB
    Werner Guttmann

Activity

Hide
Werner Guttmann added a comment -

Final patch for review.

Show
Werner Guttmann added a comment - Final patch for review.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: