Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.0.1
    • Fix Version/s: 1.0.2
    • Component/s: XML code generator
    • Labels:
      None
    • Number of attachments :
      1

      Description

      When executing 'build gen.mapping' a NullPointerExceptio is thrown and mapping classes are not generated.

      The NullPointerException is thrown at XmlBindingComponent.getCollectionType() line 1204. The method looks like:

      public String getCollectionType() {
      String result = null;
      if (_type == MEMBER)

      { result = _member.getCollection().toString(); }
      return result;
      }

      The problem is that _member.getCollection() returns null. If you change method to:

      public String getCollectionType() {
      String result = null;
      if ((_type == MEMBER) && (_member.getCollection() != null)) { result = _member.getCollection().toString(); }

      return result;
      }

      The NullPointerException does not happen any more and source is generated. What I'm not able to tell if generated code looks and works like it should. I guess this problem has been introduced with changes to castor-1470 even if the part where I aplied the fix has not been changed with it.

        Issue Links

          Activity

          Hide
          Ralf Joachim added a comment -

          Having said that I set priority to blocker as I fear that sourcegen always fails when using a binding file.

          Show
          Ralf Joachim added a comment - Having said that I set priority to blocker as I fear that sourcegen always fails when using a binding file.
          Hide
          Werner Guttmann added a comment -

          No, it does not. I have got plenty of test cases in use currently where a binding file is being used. Let me have a look at this in some more detail ....

          Show
          Werner Guttmann added a comment - No, it does not. I have got plenty of test cases in use currently where a binding file is being used. Let me have a look at this in some more detail ....
          Hide
          Werner Guttmann added a comment -

          Ralf, I think your patch is a valid patch, in that it fixes the problem. I agree that it would be ideal to realize as to why this happens, but as I am touching the source generator quite frequently these days, I am more than happy with this patch (especially in the context of the comment of this method). Btw, the problem happens on the <Mapping> type definition, which uses an unbounded reference to specify a list of class mappings. In other words, this might be related to using this construct only, as it does not happen with 'vanilla' <xs:sequences>

          In addition, I think that we should change our property definitions in src/build.xml to using $

          {basedir}

          as reference point (explicitly).

          Show
          Werner Guttmann added a comment - Ralf, I think your patch is a valid patch, in that it fixes the problem. I agree that it would be ideal to realize as to why this happens, but as I am touching the source generator quite frequently these days, I am more than happy with this patch (especially in the context of the comment of this method). Btw, the problem happens on the <Mapping> type definition, which uses an unbounded reference to specify a list of class mappings. In other words, this might be related to using this construct only, as it does not happen with 'vanilla' <xs:sequences> In addition, I think that we should change our property definitions in src/build.xml to using $ {basedir} as reference point (explicitly).
          Hide
          Werner Guttmann added a comment -

          Ralf, can you please commit this patch as is ?

          Show
          Werner Guttmann added a comment - Ralf, can you please commit this patch as is ?
          Hide
          Ralf Joachim added a comment -

          Final patch.

          Show
          Ralf Joachim added a comment - Final patch.

            People

            • Assignee:
              Ralf Joachim
              Reporter:
              Ralf Joachim
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: