castor
  1. castor
  2. CASTOR-1678

CLONE -Missing methods in generated class

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.5
    • Component/s: XML code generator
    • Labels:
      None
    • Environment:
      HP-UX 11.0
    • Number of attachments :
      2

      Description

      (From the mail list – ATTN Werner Guttmann)

      I am trying to upgrade from castor 0.9.3 to 0.9.6 (or 9.7). I am finding that castor is not creating all of the methods in the generated java classes in 0.9.6 that it generated in 0.9.3.

      We call the source generator using:

      $(JDKDIR)/java -cp $(CLASSPATH) org.exolab.castor.builder.SourceGenerator -i $(SCHEMA) -package sentry.config -f

      I have tried this using our old version of xerces (xerces.jar version 1.4.4) and the newer xerces (xml-apis.jar and xercesImpl.jar version 2.6.2) with the same result. Since the schema hasn't changed, the only other variable is castor. Perhaps I missed a configuration step somewhere?

      1. patch.c1167.20061108.txt
        43 kB
        Werner Guttmann
      2. tasks.xml
        0.9 kB

        Issue Links

          Activity

          Hide
          Susan Anderson added a comment -

          Hi Werner,

          I saw your comments on my original ticket (CASTOR-1167) that you were able to compile without compilation errors. I have again tried to compile (using 1.0.4), but I still don't have the getter and setter methods for the choices in the generated class (WebServiceMonitor). When you did your compilation, did you see those methods?

          I couldn't reopen the original ticket since it had been closed, so I opened a clone. I hope that was acceptable.

          Susan

          Show
          Susan Anderson added a comment - Hi Werner, I saw your comments on my original ticket ( CASTOR-1167 ) that you were able to compile without compilation errors. I have again tried to compile (using 1.0.4), but I still don't have the getter and setter methods for the choices in the generated class (WebServiceMonitor). When you did your compilation, did you see those methods? I couldn't reopen the original ticket since it had been closed, so I opened a clone. I hope that was acceptable. Susan
          Hide
          Ralf Joachim added a comment -

          Susan,

          can you please attach a valid XML document for sentry.xsd as Werner requested at CASTOR-1167. For anything else let's wait until Werner is back next week.

          Ralf

          Show
          Ralf Joachim added a comment - Susan, can you please attach a valid XML document for sentry.xsd as Werner requested at CASTOR-1167 . For anything else let's wait until Werner is back next week. Ralf
          Hide
          Ralf Joachim added a comment -

          As 1.0.4 is already released it can not be fixed with that one.

          Show
          Ralf Joachim added a comment - As 1.0.4 is already released it can not be fixed with that one.
          Hide
          Werner Guttmann added a comment -

          Susan, I just generated the classes once again, and I can confirm that the getter/setter for the choice in Web-service-monitor is not generated. In addition, I think you should change your XML schema in some way to (potentially) avoid naming collisions.

          Re: the choice issue, I will have a look at this later on ....

          Show
          Werner Guttmann added a comment - Susan, I just generated the classes once again, and I can confirm that the getter/setter for the choice in Web-service-monitor is not generated. In addition, I think you should change your XML schema in some way to (potentially) avoid naming collisions. Re: the choice issue, I will have a look at this later on ....
          Hide
          Werner Guttmann added a comment -

          Okay, the problem is with XMLInfo.getNodeName() in that for a choice element, this will return the string "error-if-this-is-used" (as set on line 400 of MemberFactory.java). Apparently, this problem does not manifest itself frequently .. , only when a type and its parent type both have a anonymous choice declaration as part of their content model. In this case, as both use 'error-if-this-is-used' as node names, for the latter one (at run-time), no Java field (and corresponding access methods) will be generated, as the code generator believes that for this node (as identified by its node name) code has already been generated.

          Well, this is the problem analysis. We now have to find a way to replace 'error-if-this-is-used' with something more meaningful. Any ideas ?

          Show
          Werner Guttmann added a comment - Okay, the problem is with XMLInfo.getNodeName() in that for a choice element, this will return the string " error-if-this-is-used " (as set on line 400 of MemberFactory.java). Apparently, this problem does not manifest itself frequently .. , only when a type and its parent type both have a anonymous choice declaration as part of their content model. In this case, as both use ' error-if-this-is-used ' as node names, for the latter one (at run-time), no Java field (and corresponding access methods) will be generated, as the code generator believes that for this node (as identified by its node name) code has already been generated. Well, this is the problem analysis. We now have to find a way to replace ' error-if-this-is-used ' with something more meaningful. Any ideas ?
          Hide
          Werner Guttmann added a comment -

          I think I have just come to realize that there's a 'quick win' solution. I will provide a patch in a few minutes (after some more testing, that is).

          Show
          Werner Guttmann added a comment - I think I have just come to realize that there's a 'quick win' solution. I will provide a patch in a few minutes (after some more testing, that is).
          Hide
          Werner Guttmann added a comment -

          Initial patch for review. Any comments appreciated .. . I have added a few more web-service-monitor instances to the XML instance document to test a few more cases, and as it is right now, it should fail (as the last web-service-monitor is not valid). When commenting out the last one, everything just runs fine.

          Show
          Werner Guttmann added a comment - Initial patch for review. Any comments appreciated .. . I have added a few more web-service-monitor instances to the XML instance document to test a few more cases, and as it is right now, it should fail (as the last web-service-monitor is not valid). When commenting out the last one, everything just runs fine.
          Hide
          Susan Anderson added a comment -

          Thanks for taking the time to look at this. I'm not familiar with reviewing a patch. Is there a way to copy something down to my server to try compilation? or is it just a visual reading of the .txt that you attached to this ticket?

          Show
          Susan Anderson added a comment - Thanks for taking the time to look at this. I'm not familiar with reviewing a patch. Is there a way to copy something down to my server to try compilation? or is it just a visual reading of the .txt that you attached to this ticket?
          Hide
          Werner Guttmann added a comment -

          Susan, for the time being, I am basically asking my peer committers for feedback. Once this has been reviewed, I will integrate this into the code base and provide you with a snapshot release for further testing, if that's okay with you. Please feel free to join me at http://irc.codehaus.org, channel #castor if you happen to have any questions.

          Show
          Werner Guttmann added a comment - Susan, for the time being, I am basically asking my peer committers for feedback. Once this has been reviewed, I will integrate this into the code base and provide you with a snapshot release for further testing, if that's okay with you. Please feel free to join me at http://irc.codehaus.org , channel #castor if you happen to have any questions.
          Hide
          Werner Guttmann added a comment -

          Committing as is, after adding a new CTF test to the master test suite. Susan, I will make available a snapshot release for 1.0.5 within 24 hours for you to use for testing.

          Show
          Werner Guttmann added a comment - Committing as is, after adding a new CTF test to the master test suite. Susan, I will make available a snapshot release for 1.0.5 within 24 hours for you to use for testing.
          Hide
          Werner Guttmann added a comment -

          Susan, a snapshot release is available at http://snapshots.repository.codehaus.org/org/codehaus/castor/castor/1.0.5-SNAPSHOT/ as explained in my announcement a few minutes ago. I'd appreciate any feedback (within 24 hours), if possible.

          In addition, how would you feel if I asked you for your permission to make it known to our users that you (IBM) is using Castor XML for internal product development (my assumption .. ), let's say on a user experience page (sort of stepping up marketing for Castor to some degree now that quality is returning to standard) ?

          Show
          Werner Guttmann added a comment - Susan, a snapshot release is available at http://snapshots.repository.codehaus.org/org/codehaus/castor/castor/1.0.5-SNAPSHOT/ as explained in my announcement a few minutes ago. I'd appreciate any feedback (within 24 hours), if possible. In addition, how would you feel if I asked you for your permission to make it known to our users that you (IBM) is using Castor XML for internal product development (my assumption .. ), let's say on a user experience page (sort of stepping up marketing for Castor to some degree now that quality is returning to standard) ?
          Hide
          Susan Anderson added a comment -

          Hi Werner,

          I downloaded the snapshot and compiled my code. It worked! I still have other issues that I need to work on (I may not have all the other pieces that I need to interface with castor in our environment), but I can compile.

          I will ask about using our name on your user page. My group is using castor for the Qwest account; I don't know if other IBM teams are using it. We were with Qwest before being outsourced to IBM – I'm sure you know how that goes.

          Thanks so much for working on this for me.

          Show
          Susan Anderson added a comment - Hi Werner, I downloaded the snapshot and compiled my code. It worked! I still have other issues that I need to work on (I may not have all the other pieces that I need to interface with castor in our environment), but I can compile. I will ask about using our name on your user page. My group is using castor for the Qwest account; I don't know if other IBM teams are using it. We were with Qwest before being outsourced to IBM – I'm sure you know how that goes. Thanks so much for working on this for me.
          Hide
          Werner Guttmann added a comment -

          Thanks, Susan, for the feedback. Really appreciated. I look forward to hear from you wrt to using IBM's name on our user page, and feel free to open new issues when ever required.

          Show
          Werner Guttmann added a comment - Thanks, Susan, for the feedback. Really appreciated. I look forward to hear from you wrt to using IBM's name on our user page, and feel free to open new issues when ever required.
          Hide
          Werner Guttmann added a comment -

          Bulk-closing all issues assigned to 1.0.5. Please feel free to re-open any of those when required.

          Show
          Werner Guttmann added a comment - Bulk-closing all issues assigned to 1.0.5. Please feel free to re-open any of those when required.
          Hide
          Susan Anderson added a comment -

          Hi Werner,

          My lead thinks there is no problem using our name on your user page. It is technically Qwest that is using Castor since the code we support is Qwest-proprietary, but we do work for IBM.

          Thanks for all the help on this problem.

          Susan

          Show
          Susan Anderson added a comment - Hi Werner, My lead thinks there is no problem using our name on your user page. It is technically Qwest that is using Castor since the code we support is Qwest-proprietary, but we do work for IBM. Thanks for all the help on this problem. Susan
          Hide
          Werner Guttmann added a comment -

          In that case, can you provide me with a short description of IBM (contextualized), and the apparent use case. I'll have to make up my mind where to put this in the end, but I will follow up in due time.

          Show
          Werner Guttmann added a comment - In that case, can you provide me with a short description of IBM (contextualized), and the apparent use case. I'll have to make up my mind where to put this in the end, but I will follow up in due time.

            People

            • Assignee:
              Werner Guttmann
              Reporter:
              Susan Anderson
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 30 minutes
                1h 30m