Program: 174940
Project: 174940
Buggy source:
/** 
 * try to create the correct reader starting from file name
 * @param file
 * @return
 */
public static List<GeoImageReader> createReaderForName(String file,String geoAlgorithm){
  List<GeoImageReader> girList=new ArrayList<GeoImageReader>();
  try {
    File f=new File(file);
    String parent=f.getParent();
    if (parent != null && (parent.contains("String_Node_Str") || file.contains("String_Node_Str"))) {
      H5File h5file=new H5File(file,H5File.READ);
      H5Group group=((H5Group)h5file.get("String_Node_Str"));
      List<HObject> hObjs=group.getMemberList();
      Iterator<HObject> it=hObjs.iterator();
      while (it.hasNext()) {
        HObject obj=it.next();
        AbstractCosmoSkymedImage cosmo=null;
        if (obj.getName().equals("String_Node_Str")) {
          cosmo=CosmoSkyFactory.instanceCosmoSkymed(h5file,obj.getName(),null);
        }
 else {
          if (h5file.get(obj.getName() + "String_Node_Str") != null)           cosmo=CosmoSkyFactory.instanceCosmoSkymed(h5file,obj.getName() + "String_Node_Str",obj.getName());
        }
        if (cosmo != null) {
          if (cosmo.initialise()) {
            girList.add(cosmo);
            logger.info("String_Node_Str",new Object[]{file,cosmo.getClass()});
          }
          if (girList.size() > 1)           cosmo.setContainsMultipleImage(true);
        }
      }
    }
 else     if (parent.contains("String_Node_Str") || parent.contains("String_Node_Str")) {
      girList=Sentinel1Factory.instanceS1Reader(f,geoAlgorithm);
    }
 else {
      GeoImageReader gir=null;
      if (parent.contains("String_Node_Str")) {
        gir=new TerrasarXImage(f);
      }
 else       if (parent.contains("String_Node_Str")) {
        gir=new TerrasarXImage(f);
      }
 else       if (parent.contains("String_Node_Str") || parent.contains("String_Node_Str")) {
        gir=new TerrasarXImage_SLC(f);
      }
 else       if (parent.contains("String_Node_Str") && parent.contains("String_Node_Str")) {
        gir=new Radarsat2Image_SLC(f);
      }
 else       if (parent.contains("String_Node_Str") && !parent.contains("String_Node_Str")) {
        if (GDALUtilities.isGDALAvailable())         gir=new Radarsat2ImageGDAL(f);
 else         gir=new Radarsat2Image(f);
      }
 else       if (parent.contains("String_Node_Str")) {
        gir=new Radarsat1Image(f);
      }
 else       if (parent.contains("String_Node_Str")) {
        gir=new EnvisatImage_SLC(f);
      }
 else       if (new File(file).getName().equalsIgnoreCase("String_Node_Str")) {
        TiffAlosProperties props=new TiffAlosProperties(file);
        if (props.getProductFormat().equalsIgnoreCase("String_Node_Str")) {
          gir=new GDALAlosCeos(f);
        }
 else {
          gir=new AlosGeoTiff(f);
        }
      }
 else {
        return null;
      }
      if (gir.initialise()) {
        logger.info("String_Node_Str",new Object[]{file,gir.getClass()});
        girList.add(gir);
      }
 else {
        girList=null;
      }
    }
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str" + file,ex);
    girList=null;
  }
 finally {
    return girList;
  }
}

Fixed version (ground truth):
/** 
 * try to create the correct reader starting from file name
 * @param file
 * @return
 */
public static List<GeoImageReader> createReaderForName(String file,String geoAlgorithm){
  List<GeoImageReader> girList=new ArrayList<GeoImageReader>();
  try {
    File f=new File(file);
    String parent=f.getParent();
    if (parent != null && (parent.contains("String_Node_Str") || file.contains("String_Node_Str"))) {
      H5File h5file=new H5File(file,H5File.READ);
      H5Group group=((H5Group)h5file.get("String_Node_Str"));
      List<HObject> hObjs=group.getMemberList();
      Iterator<HObject> it=hObjs.iterator();
      while (it.hasNext()) {
        HObject obj=it.next();
        AbstractCosmoSkymedImage cosmo=null;
        if (obj.getName().equals("String_Node_Str")) {
          cosmo=CosmoSkyFactory.instanceCosmoSkymed(h5file,obj.getName(),null);
        }
 else {
          if (h5file.get(obj.getName() + "String_Node_Str") != null)           cosmo=CosmoSkyFactory.instanceCosmoSkymed(h5file,obj.getName() + "String_Node_Str",obj.getName());
        }
        if (cosmo != null) {
          if (cosmo.initialise()) {
            girList.add(cosmo);
            logger.info("String_Node_Str",new Object[]{file,cosmo.getClass()});
          }
          if (girList.size() > 1)           cosmo.setContainsMultipleImage(true);
        }
      }
    }
 else     if (parent.contains("String_Node_Str") || parent.contains("String_Node_Str")) {
      girList=Sentinel1Factory.instanceS1Reader(f,geoAlgorithm);
    }
 else {
      GeoImageReader gir=null;
      if (parent.contains("String_Node_Str")) {
        gir=new TerrasarXImage(f);
      }
 else       if (parent.contains("String_Node_Str")) {
        gir=new TerrasarXImage(f);
      }
 else       if (parent.contains("String_Node_Str") || parent.contains("String_Node_Str")) {
        gir=new TerrasarXImage_SLC(f);
      }
 else       if (parent.contains("String_Node_Str") && parent.contains("String_Node_Str")) {
        if (GDALUtilities.isGDALAvailable())         gir=new Radarsat2Image_SLCGDAL(f);
 else         gir=new Radarsat2Image_SLC(f);
      }
 else       if (parent.contains("String_Node_Str") && !parent.contains("String_Node_Str")) {
        if (GDALUtilities.isGDALAvailable())         gir=new Radarsat2ImageGDAL(f);
 else         gir=new Radarsat2Image(f);
      }
 else       if (parent.contains("String_Node_Str")) {
        gir=new Radarsat1Image(f);
      }
 else       if (parent.contains("String_Node_Str")) {
        gir=new EnvisatImage_SLC(f);
      }
 else       if (new File(file).getName().equalsIgnoreCase("String_Node_Str")) {
        TiffAlosProperties props=new TiffAlosProperties(file);
        if (props.getProductFormat().equalsIgnoreCase("String_Node_Str")) {
          gir=new GDALAlosCeos(f);
        }
 else {
          gir=new AlosGeoTiff(f);
        }
      }
 else {
        return null;
      }
      if (gir.initialise()) {
        logger.info("String_Node_Str",new Object[]{file,gir.getClass()});
        girList.add(gir);
      }
 else {
        girList=null;
      }
    }
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str" + file,ex);
    girList=null;
  }
 finally {
    return girList;
  }
}