castor
  1. castor
  2. CASTOR-1928

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
        3 kB
        David M. Karr
      2. patch.c1928.20070401.txt
        3 kB
        Werner Guttmann

        Activity

        Werner Guttmann made changes -
        Field Original Value New Value
        Assignee Werner Guttmann [ wguttmn ]
        Werner Guttmann made changes -
        Fix Version/s 1.1.1 [ 13080 ]
        Hide
        Werner Guttmann added a comment -

        Final patch for review.

        Show
        Werner Guttmann added a comment - Final patch for review.
        Werner Guttmann made changes -
        Attachment patch.c1928.20070401.txt [ 26572 ]
        Werner Guttmann made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Ralf Joachim made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Werner Guttmann
            Reporter:
            David M. Karr
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: