Hi Earl,
Thanks for your interest in Castor and willingness to help fix the issue you've run across. In order for us to better determine if your patch is the proper one, can you open a bug report at http://bugzilla.exolab.org and attach your patch (as a diff file), as well as a small test case which demonstrates the problem before the patch is applied. More information on contributing to Castor can be found here: http://castor.exolab.org/cvs.html#Guidelines-For-Code-Contribution Thanks, --Keith [EMAIL PROTECTED] wrote: > > I'm a newbie to Castor, and an infrequent Java Programmer, so please be > gentle in your response. I'll try to explain the problem that I've had to > the best of my abilities. I've made a change to the XMLClassDescriptorImpl. > It resolves the problem, but since I have very little idea what I'm doing, > I don't know what problems my solution might cause. > > The class that I was trying to marshal had 3 levels of inheritance. > Apparently, one of the methods (elements) that has been added to the > allElements array has been overridden more than once and is in allElements > twice. Because it is an inherited method, it is also in the inherited > array. The size of localElements is determined by subtracting the size of > the inherited array from the size of the allElements array. The code > starting at line 776 below causes the localElements array to have (in this > case) one null entry as the last entry in the array because the entry from > allElements is not written to localElements if it is inherited. > > For my quick fix, I simply traversed the localElements array and rewrote it > without the null entry. My biggest concern is what problems I may have > caused down the road. Marshalling appears to work fine. This is probably > because the method in question was not a Getter or a Setter. > > Any insights into this problem, or my solution to it, would be greatly > appreciated. > > localElements = new XMLFieldDescriptor[allElements.length - > inherited.length]; > int localIdx = 0; > int localCnt=0; > int localNewIdx=0; > 776 for (int i = 0; i < allElements.length; i++) { > XMLFieldDescriptor desc = allElements[i]; > boolean isInherited = false; > for (int idx = 0; idx < inherited.length; idx++) { > if (inherited[idx].equals(desc)) { > isInherited = true; > break; > } > } > if (!isInherited) { > localElements[localIdx] = desc; > ++localIdx; > } > } > // count non-null entries in localElements > 790 for (int j = 0; j < localElements.length; j++) { > if(!(localElements[j]== null)) { > localCnt++; > } > > } > // create a new array to replace localElements > XMLFieldDescriptor[]localElementsNew = new > XMLFieldDescriptor[localCnt]; > // populate new array with non-null values from localElements > for (int k = 0; k < localElements.length; k++) { > if(!(localElements[k]== null)) { > localElementsNew[localNewIdx] = localElements[k]; > localNewIdx++; > } > > } > //replace localElements with new array > 802 localElements = localElementsNew; > > Thanks, > > Earl Armstrong, CLU, FLMI, ACS, AIAA > __________________________________ > IS Individual Life Systems Team - 3A-AS > LIFE-COMM New Business, NextGen > Protective Life Corporation > Phone (205)268-2965 Fax (205)268-3474 > > ----------------------------------------- > Confidentiality Notice: This e-mail communication and any attachments may contain > confidential and privileged information for the use of the designated recipients > named above. If you are not the intended recipient, you are hereby notified that you > have received this communication in error and that any review, disclosure, > dissemination, distribution or copying of it or its contents is prohibited. If you > have received this communication in error, please notify me immediately by replying > to this message and deleting it from your computer. Thank you. > > ----------------------------------------------------------- > If you wish to unsubscribe from this mailing, send mail to > [EMAIL PROTECTED] with a subject of: > unsubscribe castor-dev ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
