This one time, at band camp, DU SONG Romuald said:
DSR>I have a look to your code in CVS to handle the bug, and I was
DSR>wondering whether it would work because when you do :
DSR>
DSR> new TypeConvertorInfo( new SQLTypeConvertor( java.lang.Integer.class,
DSR>java.util.Date.class ) {
DSR> public Object convert( Object obj, String param ) {
DSR> try {
DSR> getParamDateFormat().applyPattern(
DSR>org.exolab.castor.mapping.loader.Types.getFullDatePattern( param ) );
DSR> return getParamDateFormat().parse( obj.toString() );
DSR> } catch ( ParseException except ) {
DSR> throw new IllegalArgumentException( except.toString() );
DSR> }
DSR> }
DSR> } ),
DSR>
DSR>You apply a pattern on a clone, then you format with another clone,
DSR> is my understanding correct ?
Yes, currently that is how the code is written. You bring up a very
good point because the real member variable does not actually have the
pattern applied to it. Just thinking off the top of my head, I could
wrap the whole thing in the setter. But I'm not sure if this is good
enough unless I introduce some synchronization. I dont' think that I
can just use a synchronization block in the getters and setters only,
each block where the getters and setters are used will need to be
synchronized. Below is an example including both of these ideas:
new TypeConvertorInfo( new SQLTypeConvertor( java.lang.Integer.class,
java.util.Date.class ) {
public Object convert( Object obj, String param ) {
try {
synchronized
{
setParamDateFormat( getParamDateFormat().applyPattern(
org.exolab.castor.mapping.loader.Types.getFullDatePattern( param ) ) );
return setParamDateFormat( getParamDateFormat().parse(
obj.toString() ) );
}
} catch ( ParseException except ) {
throw new IllegalArgumentException( except.toString() );
}
}
} ),
What do you think, Du Song?
Bruce
--
perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'
The Castor Project
http://www.castor.org/
Apache Geronimo
http://incubator.apache.org/projects/geronimo.html
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev