Revision 42218 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeature.java

View differences:

DefaultFeature.java
135 135
            value = attribute.getFeatureAttributeGetter().setter(value);
136 136
        }
137 137

  
138
        if ( attribute.getObjectClass().isInstance(value) ) {
139
            this.data.set(i, value);
140
            return;
141
        }
138
        Class objectClass = attribute.getObjectClass();
139
        if( objectClass!=null ) {
140
            if ( objectClass.isInstance(value) ) {
141
                this.data.set(i, value);
142
                return;
143
            }
142 144

  
143
        if ( !attribute.getObjectClass().isInstance(value) ) {
144
            try {
145
                value
146
                        = this.getDataTypesManager().coerce(attribute.getType(),
147
                                value);
148
            } catch (CoercionException e) {
149
                throw new IllegalArgumentException("Can't convert to "
150
                        + this.getDataTypesManager().getTypeName(
151
                                attribute.getType()) + " from '"
152
                        + value.getClass().getName() + "' with value '"
153
                        + value.toString() + "'.");
145
            if ( !objectClass.isInstance(value) ) {
146
                try {
147
                    value
148
                            = this.getDataTypesManager().coerce(attribute.getType(),
149
                                    value);
150
                } catch (CoercionException e) {
151
                    throw new IllegalArgumentException("Can't convert to "
152
                            + this.getDataTypesManager().getTypeName(
153
                                    attribute.getType()) + " from '"
154
                            + value.getClass().getName() + "' with value '"
155
                            + value.toString() + "'.");
156
                }
154 157
            }
155 158
        }
156

  
157 159
        this.data.set(i, value);
158 160
    }
159 161
	

Also available in: Unified diff