Revision 40975 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/FeatureTypeManager.java

View differences:

FeatureTypeManager.java
239 239
				        continue;
240 240
				    }
241 241
				}
242
				if (tAttr.getDataType() != sAttr.getDataType()) {
242
				if (tAttr.getType() != sAttr.getType()) {
243
				    /*
244
				     * Ignore if type is not the same (user removed field
245
				     * and added another with same name but different type)
246
				     */
243 247
					continue;
244 248
				}
245 249
				attrInSourceToUse.add(sAttr.getName());
......
252 256
			Iterator iter = target.getType().iterator();
253 257
			FeatureAttributeDescriptor tAttr;
254 258
			FeatureAttributeDescriptor tAttr_edi;
259
			FeatureAttributeDescriptor srcAtt;
255 260
			
256 261
			/*
257 262
			 * field name in source feature
......
294 299
				    s_name = t_name;
295 300
				}
296 301
				
297
				if (source.getType().get(s_name) != null) {
302
				srcAtt = source.getType().getAttributeDescriptor(s_name);
303
				
304
				if (srcAtt != null &&
305
				    /*
306
				     * This prevents the case when user has removed field and
307
				     * added new field with same name and different type.
308
				     * In that case, value will be the default value (else below)
309
				     */
310
				    srcAtt.getType() == tAttr.getType()) {
311
				    
298 312
					target.set(t_name, source.get(s_name));
313
					
299 314
				} else {
300 315
					target.set(t_name, tAttr.getDefaultValue());
301 316
				}

Also available in: Unified diff