I have finally managed to hook Jesse's previous hacks for LenientFeature
so they are called from a LenientFeatureFactory. I could not manage to
use LenientFeatureFactory with SimpleFeatureBuilder as the builder is
providing its own validation.
The remaining problem comes down to a "assumeCorrectOrder" method that
is supposed to return null when the values cannot be used in the order
provided. This is not happening right now since the functionality
depends on Types.parse method shown below:
> public static Object parse(AttributeDescriptor descriptor, Object
> value) throws IllegalArgumentException {
> if (value == null){
> if( descriptor.isNillable()){
> return descriptor.getDefaultValue();
> }
> }
> else {
> Class target = descriptor.getType().getBinding();
> if ( !target.isAssignableFrom( value.getClass() ) ) {
> // attempt to convert
> Object converted = Converters.convert(value,target);
> if ( converted != null ) {
> return converted;
> }
> }
> }
> return value;
> }
It is a little startling that you can parse null into a default value -
but this is not what is tripping me up here. Instead the
Converters.convert( "name2", Double.class ) is managing to return "name2"...
If we cannot convert I have the following guides:
- Old code seems to assume the value returned from parse will be null
- The javadocs say an IllegalArgumentException will be thrown
- The code as written just returns the original value
I am going to patch locally to throw an IllegalArgumentException since I
tend to believe the javadocs.
Jody
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel