History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CASTOR-2078
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Werner Guttmann
Reporter: Ron Corcuera
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
castor

Castor 1.1.2.1 not generating choices correctly

Created: 30/Jul/07 10:51 AM   Updated: 14/Mar/08 06:41 AM
Component/s: XML code generator
Affects Version/s: 1.1.1, 1.1.2, 1.1.2.1
Fix Version/s: 1.2

Time Tracking:
Not Specified

File Attachments: 1. XML File CheckOutItemResponse.xml (3 kb)
2. XML File CheckOutItemResponse2.xml (2 kb)
3. Java Source File CheckOutItemResponseChoiceSequence2.java (7 kb)
4. XML File ncip_short_schema.xsd (6 kb)
5. XML File ncip_v1_01.xsd (18 kb)
6. Text File patch.c2078.20070816.txt (15 kb)
7. Text File patch.c2078.20080803.txt (0.6 kb)

Environment: Red Hat Enterprise Linux AS release 3 (Taroon Update 6)


 Description  « Hide
I am attempting to upgrade from Castor version 0.9.9 to version 1.1.2.1 and I'm running into a problem. I'm also using the corresponding castor-codegen and the anttask jars. In my schema, I have an element, CheckOutItemResponse, which contains two elements. One of them is a choice which the source generator called CheckOutItemResponseChoice. The CheckOutItemResponseChoice contains two sequences which the source generator called CheckOutItemResponseChoiceSequence and CheckOutItemResponseChoiceSequence2. Good so far. But, CheckOutItemResponseChoiceSequence2 contains, among other elements, another choice. Here lies the problem. Within the generated CheckOutItemResponseChoiceSequence2 object, the source generator created a member variable incorrectly named CheckOutItemResponseChoiceSequenceChoice. No object of that name was ever created. However, a CheckOutItemResponseChoiceSequence2Choice was created but is not being referenced correctly by CheckOutItemResponseChoiceSequence2. BTW, the schema that I'm using contains many elements with the same pattern. Version 0.9.9 generated the source correctly. I can't seem to get version 1.1.2.1 to do the same. I've attached a simplified version of the schema and the generated code with the wrong reference to hopefully shed some light.

I appreciate any help.
--Ron Corcuera



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Werner Guttmann - 09/Aug/07 07:04 AM
Initial patch for review.

Werner Guttmann - 09/Aug/07 07:06 AM
Whilst this patch resolves the issue at hand, it also breaks compatibility with older versions of Castor. As such, re-generation of classes is a necessity, and the XML instance documents will have to be altered as well. In other words, this is a blocker, and the solution introduces a break. But I don't see any other way how to go about this.

Werner Guttmann - 10/Aug/07 06:35 AM
Ron, could you please attach a sample XML document that in your view should successfully unmarshall against the classes generated from your XML schema ? I need to build a test case to avoid future regression issues in this code area.

Ron Corcuera - 13/Aug/07 03:56 PM
Here is a sample XML file created by a server with generated code based on Castor 0.9.9. Please note the element DateDue which is the choice that the newer version is having problems with.

Ron Corcuera - 13/Aug/07 03:57 PM
Here is a sample XML file created by a server with generated code based on Castor 0.9.9. Please note the element DateDue which is the choice that the newer version is having problems with.

Werner Guttmann - 13/Aug/07 05:20 PM
Rom, the XML document instance you attached does not match the XML schema you've attached previously. Either you attach a new XML schema instance that validates against the XML given, or you re-attach a new sample XML document instance that matches the XML schema. Your choice ...

Werner Guttmann - 14/Aug/07 03:45 AM
Ron, I am basically ready to commit the patch as is (though I will have to add some documentation as we are changing Castor's functional behavior), but without a proper test to be added to Castor's internal test suite, I won't be able to proceed.

Ron Corcuera - 15/Aug/07 09:45 AM
Werner, here is another version of the schema and I'll attach another version of the XML that conforms to this. Hopefully, you can use this for your test.

Ron Corcuera - 15/Aug/07 09:46 AM
Werner, this is a new version of the XML that conforms to the ncip_short_schema.xsd. This, hopefully, will work for your test. Thanks.

Werner Guttmann - 16/Aug/07 08:23 AM
Final patch that adds a new test to the CTF suite.