Source:
private static Object[] copyAttributes( SimpleFeatureType destSchema, SimpleFeature source, Map<String, Iterator< ? extends Geometry>> geometries, Map<String, String> attributeMap, MathTransform mt ) { Object[] attributes = new Object[destSchema.getAttributeCount()]; IProgressMonitor mon = new NullProgressMonitor(); for( int i = 0; i < attributes.length; i++ ) { String sourceAttributeName = destSchema.getDescriptor(i).getName().getLocalPart(); String name = attributeMap.get(sourceAttributeName); if (name != null) { if (destSchema.getDescriptor(sourceAttributeName).getType().getBinding().isAssignableFrom( source.getFeatureType().getDescriptor(sourceAttributeName).getType().getBinding())) { attributes[i] = source.getAttribute(name); } else { if (AdapterUtil.instance.canAdaptTo( source.getAttribute(sourceAttributeName), destSchema.getDescriptor(i).getType().getBinding())) { try { attributes[i] = AdapterUtil.instance.adaptTo( destSchema.getDescriptor(i).getType().getBinding(), source.getAttribute(sourceAttributeName), mon); } catch (Exception e) { e.printStackTrace(); } } else { attributes[i] = destSchema.getDescriptor(i).getDefaultValue(); } } } else { attributes[i] = destSchema.getDescriptor(i).getDefaultValue(); } if (attributes[i] instanceof Geometry) { Class< ? extends Geometry> geomType = (Class< ? extends Geometry>) destSchema .getDescriptor(i).getType().getBinding(); if (!geomType.isAssignableFrom(attributes[i].getClass())) { Collection< ? extends Geometry> geom = createCompatibleGeometry( (Geometry) attributes[i], geomType); Iterator< ? extends Geometry> giter = geom.iterator(); attributes[i] = giter.next(); if (giter.hasNext()) geometries.put(sourceAttributeName, giter); } attributes[i] = transformGeom((Geometry) attributes[i], mt); } } return attributes; }

Target:
private static Object[] copyAttributes( SimpleFeatureType destSchema, SimpleFeature source, Map<String, Iterator< ? extends Geometry>> geometries, Map<String, String> attributeMap, MathTransform mt ) { Object[] attributes = new Object[destSchema.getAttributeCount()]; IProgressMonitor mon = new NullProgressMonitor(); for( int i = 0; i < attributes.length; i++ ) { String sourceAttributeName = destSchema.getDescriptor(i).getName().getLocalPart(); String name = attributeMap.get(sourceAttributeName); if (name != null) { if (destSchema.getDescriptor(sourceAttributeName).getType().getBinding().isAssignableFrom( source.getFeatureType().getDescriptor(sourceAttributeName).getType().getBinding())) { attributes[i] = source.getAttribute(name); } else { if (AdapterUtil.instance.canAdaptTo( source.getAttribute(sourceAttributeName), destSchema.getDescriptor(i).getType().getBinding())) { try { attributes[i] = AdapterUtil.instance.adaptTo( destSchema.getDescriptor(i).getType().getBinding(), source.getAttribute(sourceAttributeName), mon); } catch (Exception e) { CorePlugin.log("", e); } } else { attributes[i] = destSchema.getDescriptor(i).getDefaultValue(); } } } else { attributes[i] = destSchema.getDescriptor(i).getDefaultValue(); } if (attributes[i] instanceof Geometry) { Class< ? extends Geometry> geomType = (Class< ? extends Geometry>) destSchema .getDescriptor(i).getType().getBinding(); if (!geomType.isAssignableFrom(attributes[i].getClass())) { Collection< ? extends Geometry> geom = createCompatibleGeometry( (Geometry) attributes[i], geomType); Iterator< ? extends Geometry> giter = geom.iterator(); attributes[i] = giter.next(); if (giter.hasNext()) geometries.put(sourceAttributeName, giter); } attributes[i] = transformGeom((Geometry) attributes[i], mt); } } return attributes; }