Program: 175183
Project: 175183
Buggy source:
/** 
 * @param imageP poligono creato con i punti di riferimento dell'immagine
 * @param geoName
 * @param dataStore  shape file
 * @param fc
 * @param schema
 * @param types
 * @return Polygons (geometry) that are the intersection between the shape file and the sar image
 * @throws IOException
 */
public static GeometricLayer createFromSimpleGeometry(final Polygon imageP,final String geoName,FeatureCollection fc,final String[] schema,final String[] types) throws IOException {
  GeometricLayer out=null;
  if (geoName.contains("String_Node_Str") || geoName.contains("String_Node_Str")) {
    out=new GeometricLayer(GeometricLayer.POLYGON);
    out.setFeatureCollection(fc);
    FeatureIterator<?> fi=fc.features();
    try {
      ThreadPoolExecutor executor=new ThreadPoolExecutor(2,Runtime.getRuntime().availableProcessors(),2,TimeUnit.SECONDS,new LinkedBlockingQueue<Runnable>());
      List<Callable<Object[][]>> tasks=new ArrayList<Callable<Object[][]>>();
      while (fi.hasNext()) {
        final Feature f=fi.next();
        Callable<Object[][]> run=new Callable<Object[][]>(){
          Geometry g=(Geometry)f.getDefaultGeometryProperty().getValue();
          @Override public Object[][] call(){
            List<Object[]> result=java.util.Collections.synchronizedList(new ArrayList<Object[]>());
            try {
              AttributesGeometry at=new AttributesGeometry(schema);
              for (int i=0; i < f.getProperties().size(); i++) {
                at.set(schema[i],f.getProperty(schema[i]).getValue());
              }
              Geometry gbuff=g.buffer(0);
              for (int i=0; i < gbuff.getNumGeometries(); i++) {
                if (imageP.contains(gbuff)) {
                  Object[] o=new Object[2];
                  o[0]=gbuff;
                  o[1]=at;
                  result.add(o);
                }
 else                 if (imageP.intersects(gbuff)) {
                  Geometry p2=EnhancedPrecisionOp.intersection(imageP,gbuff);
                  p2=p2.buffer(0);
                  if (!p2.isEmpty()) {
                    for (int ii=0; ii < p2.getNumGeometries(); ii++) {
                      Object[] o=new Object[2];
                      o[0]=p2.getGeometryN(ii);
                      o[1]=at;
                      result.add(o);
                    }
                  }
                }
              }
            }
 catch (            Exception ex) {
              logger.error(ex.getMessage(),ex);
            }
            return result.toArray(new Object[0][]);
          }
        }
;
        tasks.add(run);
      }
      List<Future<Object[][]>> results=executor.invokeAll(tasks);
      executor.shutdown();
      for (      Future<Object[][]> f : results) {
        Object o[][]=f.get();
        if (o != null) {
          for (int i=0; i < o.length; i++) {
            out.put((Geometry)o[i][0],(AttributesGeometry)o[i][1]);
          }
        }
      }
    }
 catch (    Exception e) {
      logger.error(e.getMessage(),e);
    }
 finally {
      fi.close();
    }
  }
 else   if (geoName.contains("String_Node_Str")) {
    out=new GeometricLayer(GeometricLayer.POINT);
    FeatureIterator<?> fi=fc.features();
    try {
      while (fi.hasNext()) {
        Feature f=fi.next();
        AttributesGeometry at=new AttributesGeometry(schema);
        for (int i=0; i < f.getProperties().size(); i++) {
          at.set(schema[i],f.getProperty(schema[i]).getValue());
        }
        Geometry p2=((Geometry)(f.getDefaultGeometryProperty().getValue())).intersection(imageP);
        if (!p2.isEmpty()) {
          out.put(p2,at);
        }
      }
    }
  finally {
      fi.close();
    }
  }
  return out;
}

Fixed version (ground truth):
/** 
 * @param imageP poligono creato con i punti di riferimento dell'immagine
 * @param geoName
 * @param dataStore  shape file
 * @param fc
 * @param schema
 * @param types
 * @return Polygons (geometry) that are the intersection between the shape file and the sar image
 * @throws IOException
 */
public static GeometricLayer createFromSimpleGeometry(final Polygon imageP,final String geoName,FeatureCollection fc,final String[] schema,final String[] types,boolean applayTransformation,GeoTransform transform) throws IOException {
  GeometricLayer out=null;
  if (geoName.contains("String_Node_Str") || geoName.contains("String_Node_Str")) {
    out=new GeometricLayer(GeometricLayer.POLYGON);
    out.setFeatureCollection(fc);
    FeatureIterator<?> fi=fc.features();
    try {
      ThreadPoolExecutor executor=new ThreadPoolExecutor(2,Runtime.getRuntime().availableProcessors(),2,TimeUnit.SECONDS,new LinkedBlockingQueue<Runnable>());
      List<Callable<Object[][]>> tasks=new ArrayList<Callable<Object[][]>>();
      while (fi.hasNext()) {
        final Feature f=fi.next();
        Callable<Object[][]> run=new Callable<Object[][]>(){
          Geometry g=(Geometry)f.getDefaultGeometryProperty().getValue();
          @Override public Object[][] call(){
            List<Object[]> result=java.util.Collections.synchronizedList(new ArrayList<Object[]>());
            try {
              AttributesGeometry at=new AttributesGeometry(schema);
              for (int i=0; i < f.getProperties().size(); i++) {
                at.set(schema[i],f.getProperty(schema[i]).getValue());
              }
              Geometry gbuff=g.buffer(0);
              for (int i=0; i < gbuff.getNumGeometries(); i++) {
                if (imageP.contains(gbuff)) {
                  Object[] o=new Object[2];
                  o[0]=gbuff;
                  o[1]=at;
                  result.add(o);
                }
 else                 if (imageP.intersects(gbuff)) {
                  Geometry p2=EnhancedPrecisionOp.intersection(imageP,gbuff);
                  p2=p2.buffer(0);
                  if (!p2.isEmpty()) {
                    for (int ii=0; ii < p2.getNumGeometries(); ii++) {
                      Object[] o=new Object[2];
                      o[0]=p2.getGeometryN(ii);
                      o[1]=at;
                      result.add(o);
                    }
                  }
                }
              }
            }
 catch (            Exception ex) {
              logger.error(ex.getMessage(),ex);
            }
            return result.toArray(new Object[0][]);
          }
        }
;
        tasks.add(run);
      }
      List<Future<Object[][]>> results=executor.invokeAll(tasks);
      executor.shutdown();
      for (      Future<Object[][]> f : results) {
        Object o[][]=f.get();
        if (o != null) {
          for (int i=0; i < o.length; i++) {
            Geometry g=(Geometry)o[i][0];
            if (applayTransformation && transform != null)             g=transform.transformGeometryPixelFromGeo(g);
            out.put(g,(AttributesGeometry)o[i][1]);
          }
        }
      }
    }
 catch (    Exception e) {
      logger.error(e.getMessage(),e);
    }
 finally {
      fi.close();
    }
  }
 else   if (geoName.contains("String_Node_Str")) {
    out=new GeometricLayer(GeometricLayer.POINT);
    FeatureIterator<?> fi=fc.features();
    try {
      while (fi.hasNext()) {
        Feature f=fi.next();
        AttributesGeometry at=new AttributesGeometry(schema);
        for (int i=0; i < f.getProperties().size(); i++) {
          at.set(schema[i],f.getProperty(schema[i]).getValue());
        }
        Geometry p2=((Geometry)(f.getDefaultGeometryProperty().getValue())).intersection(imageP);
        if (!p2.isEmpty()) {
          if (applayTransformation && transform != null)           p2=transform.transformGeometryPixelFromGeo(p2);
          out.put(p2,at);
        }
      }
    }
 catch (    Exception e) {
      logger.error(e.getMessage(),e);
    }
 finally {
      fi.close();
    }
  }
  return out;
}