castor
  1. castor
  2. CASTOR-1881

Unwanted generation from imported schemas

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1 M1, 1.1 M2, 1.1 M3, 1.1
    • Fix Version/s: 1.2
    • Component/s: XML code generator
    • Labels:
      None
    • Environment:
      Problem started at 0.9.9-M1 including 1.1, 0.9.7 works as expected
    • Testcase included:
      yes
    • Number of attachments :
      5

      Description

      I never have "generateImportedSchemas" enabled. Nevertheless castor generates sources from imported schemas.
      In my case only the complexTypes of the imported schema are generated which are referenced from the main schema.

        Activity

        Hide
        Matthias Hanisch added a comment -

        Some comments on the test case: in the binding file I specified a different package for the imported schema.
        castor <= 0.9.7 generates only code for element A in the base package, castor >= 0.9.9M1 also generates the code for the complexType X in the package speciified by the binding file.

        Show
        Matthias Hanisch added a comment - Some comments on the test case: in the binding file I specified a different package for the imported schema. castor <= 0.9.7 generates only code for element A in the base package, castor >= 0.9.9M1 also generates the code for the complexType X in the package speciified by the binding file.
        Hide
        Werner Guttmann added a comment -

        Matthias, when running your test case, the code generator creates class 'A' (and its descriptor) only. This is against SVN trunk, to be more precise.

        Show
        Werner Guttmann added a comment - Matthias, when running your test case, the code generator creates class 'A' (and its descriptor) only. This is against SVN trunk, to be more precise.
        Hide
        Werner Guttmann added a comment -

        In other words, it seems like I cannot really reproduce your problem.

        Show
        Werner Guttmann added a comment - In other words, it seems like I cannot really reproduce your problem.
        Hide
        Matthias Hanisch added a comment -

        Werner, thanks for looking. I will redo the tests with latest SVN sources.
        But no promises for today - weekend is near

        Show
        Matthias Hanisch added a comment - Werner, thanks for looking. I will redo the tests with latest SVN sources. But no promises for today - weekend is near
        Hide
        Matthias Hanisch added a comment -

        I resynced against SVN and recompiled the jars. I still get the problem.
        So how can we proceed here? Should I provided my eclipse project?
        I just add castor-1.1-latest (codegen+xml) or castor-0.9.7 to my build path and run the unit test in eclipse.
        In the first case I get A+X, in the second I get only A.

        Show
        Matthias Hanisch added a comment - I resynced against SVN and recompiled the jars. I still get the problem. So how can we proceed here? Should I provided my eclipse project? I just add castor-1.1-latest (codegen+xml) or castor-0.9.7 to my build path and run the unit test in eclipse. In the first case I get A+X, in the second I get only A.
        Hide
        Matthias Hanisch added a comment -

        Screenshot how it looks on Eclipse

        Show
        Matthias Hanisch added a comment - Screenshot how it looks on Eclipse
        Hide
        Werner Guttmann added a comment -

        Matthias, I just realized that I failed to see that the classes for X and XDescriptor have been generated, indeed.

        Show
        Werner Guttmann added a comment - Matthias, I just realized that I failed to see that the classes for X and XDescriptor have been generated, indeed.
        Hide
        Werner Guttmann added a comment -

        Initial patch for review. CTF completes without any problems ...... and please note that you'll get compilation errors on e.g. A in this case.

        Show
        Werner Guttmann added a comment - Initial patch for review. CTF completes without any problems ...... and please note that you'll get compilation errors on e.g. A in this case.
        Hide
        Matthias Hanisch added a comment -

        Test case works for me now as expected. Thanks for the quick fix.

        Show
        Matthias Hanisch added a comment - Test case works for me now as expected. Thanks for the quick fix.
        Hide
        Matthias Hanisch added a comment -

        I looked on the SVN repository and saw that the fix above is not committed yet.
        I want to confirm again, that this fix works for me also in real-life applications.
        If you have no objections, it would be nice to get this included in the next Castor release.
        I know that you have to care about a lot of other issues, too, I just want to make sure that it does not get forgotten.

        Show
        Matthias Hanisch added a comment - I looked on the SVN repository and saw that the fix above is not committed yet. I want to confirm again, that this fix works for me also in real-life applications. If you have no objections, it would be nice to get this included in the next Castor release. I know that you have to care about a lot of other issues, too, I just want to make sure that it does not get forgotten.
        Hide
        Werner Guttmann added a comment -

        Updated patch.

        Show
        Werner Guttmann added a comment - Updated patch.
        Hide
        Werner Guttmann added a comment -

        JUnit test case relative to src/bugs.

        Show
        Werner Guttmann added a comment - JUnit test case relative to src/bugs.
        Hide
        Matthias Hanisch added a comment -

        It seems that the second patch does not contain any code changes but only updated line information. So I didn't apply the new one because I succesfully run the first patch since 10 weeks (the whole project would be incompilable and unrunnable without it).
        If some action from my side is required to finalize this entry, then just raise a hand.

        Show
        Matthias Hanisch added a comment - It seems that the second patch does not contain any code changes but only updated line information. So I didn't apply the new one because I succesfully run the first patch since 10 weeks (the whole project would be incompilable and unrunnable without it). If some action from my side is required to finalize this entry, then just raise a hand.
        Hide
        Matthias Hanisch added a comment -

        Werner, the patch above does not work anymore with the current SVN trunk.
        Types from external schemas, which are referenced in the "main" schema, are created again, even if "generateImportedSchemas" is false.
        Also, some code pieces in SourceGenerator look dubious.
        E.g. processImportedSchemas() is only called if _generateImported is true. But inside there is a test if _generateImported is false. Of course this test will always evaluate to false.

        Show
        Matthias Hanisch added a comment - Werner, the patch above does not work anymore with the current SVN trunk. Types from external schemas, which are referenced in the "main" schema, are created again, even if "generateImportedSchemas" is false. Also, some code pieces in SourceGenerator look dubious. E.g. processImportedSchemas() is only called if _generateImported is true. But inside there is a test if _generateImported is false. Of course this test will always evaluate to false.
        Hide
        Matthias Hanisch added a comment -

        Ok. it's me again. When I apply only patch for 1881, it seems to work.
        I removed the patch for 1934 now, which seemed to interfer. Sorry for the confusion.
        My code about the dubious code is still valid, nevertheless.

        Show
        Matthias Hanisch added a comment - Ok. it's me again. When I apply only patch for 1881, it seems to work. I removed the patch for 1934 now, which seemed to interfer. Sorry for the confusion. My code about the dubious code is still valid, nevertheless.
        Hide
        Werner Guttmann added a comment -

        I will have to look into this (again). I've got plenty of time this weekend, so let's see how far I get. I wish somebody would be willing to pay for this .. as clearly I am using my spare time ... . Basically, I am in the process of preparing release 1.1.3.

        Show
        Werner Guttmann added a comment - I will have to look into this (again). I've got plenty of time this weekend, so let's see how far I get. I wish somebody would be willing to pay for this .. as clearly I am using my spare time ... . Basically, I am in the process of preparing release 1.1.3.
        Hide
        Werner Guttmann added a comment -

        > Also, some code pieces in SourceGenerator look dubious.
        Matthias, can you please attach a patch that identifies the dubious code in question with e.g. a // TODO item ?

        Show
        Werner Guttmann added a comment - > Also, some code pieces in SourceGenerator look dubious. Matthias, can you please attach a patch that identifies the dubious code in question with e.g. a // TODO item ?
        Hide
        Werner Guttmann added a comment -

        Actually, found it myself ... .

        Show
        Werner Guttmann added a comment - Actually, found it myself ... .
        Hide
        Werner Guttmann added a comment -

        The patch committed deals with this little stupid code section in SourceGenerator as well .. .

        Show
        Werner Guttmann added a comment - The patch committed deals with this little stupid code section in SourceGenerator as well .. .
        Hide
        Matthias Hanisch added a comment -

        Thank you very much, Werner!
        I will try to verify this ASAP. Probably begin of next week.

        Show
        Matthias Hanisch added a comment - Thank you very much, Werner! I will try to verify this ASAP. Probably begin of next week.

          People

          • Assignee:
            Werner Guttmann
            Reporter:
            Matthias Hanisch
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: