|
|
|
[
Permlink
| « Hide
]
Werner Guttmann - 22/Jul/07 01:18 PM
Looks like we have to change the way we deal with default values in special cases like this.
I have just started working with castor, so I was wondering what a typical response time for this kind of bug is. IE are small patches released every couple weeks, or every couple months.
Also, I would appreciate if anyone knows any work-arounds that don't involve modification of the schema. Thanks! Ben, I assume that (given there's timer available for any of us), it wouldn't take longer than to days to implement a solution. Problem is that time for at least myself is somewhat limited right. now. Iow, a fix should be shipped with 1.2. Normally, we ship minor releases every six to 10 weeks. Would that meet your requirements ?
it looks like 1.1.2.1 was released at the end of June. It sounds like end of August or early September is a reasonable estimate for when 1.1.2.2 will be released. I believe I can wait about 4 weeks for this fix.
Thank you for the prompt responses. I started to look at your issue recently and I think the place to add the additional constructor during source generation is the SourceFactory's createSourceCode method.
This first INCOMPLETE patch generates a constructor like this (if we have an element that contains a complexType with a simpleContent): public X(final java.lang.String defaultValue) { This patch is still incomplete because of the lack of type conversion inside the contructor. We need to cast from String to BigDecimal in your case. I looked at the create(From/To)JavaObjectCode methods of XsType, but they don't do what we want here. I'm currently searching the sources to find some reusable piece of code that does the classcasting for us. Please stand by, I will comment about my results soon. Looking at the casting issue again and again during the last weeks, I tried several code code parts in the castor codebase. My goal was is to reuse some implementation that produces code that casts a string to the a object instance.
The most fitting method for this wolud be imho XSType.createToJavaObjectCode(). This method is overridden by the sibclasses like XSInteger to produce this code. I thought I found the solution fpr our problem here, but having a closer look into all implementations of XSType, I discovered some inconsistency. There are several XSTypes that produce only BigDecimal value = stringValue. this is not a valid cast. Classes I found are XSDate, XSDatetime, XSG*, XSTime, XSDecimal, XSUnsignedLong. So my question is: Is the createToJavaObjectCode in XSDecimal and XSUnsignedLong buggy or am I missing some point? Matthias and I (Werner) have had a short discussion on this subject yesterday. We sort of agree that for some XML schema types, this does not work at all. I have asked Matthias to provide me with one or two test cases that highlight the incorrect behavior. Once that has been done, we'll be able to make some progress on this issue.
Matthias, can you please attach a new CTF test - based upon the XML schema provided - that checks for consistency. Given that a default value is given, it would be nice to marshal only and compare against a gold file.
Matthias, did you ever try to run the CTF with this. I am getting 1 error and 14 failures .. can you please double-check ?
jepp sorry, I overlooked one nullpointercheck.
The new patch fixes this as well as adds a new test to the xmlctf. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||