Program: 175131
Project: 175131
Buggy source:
/** 
 * try to create the correct reader starting from file name
 * @param file
 * @return
 */
public static List<GeoImageReader> createReaderForName(String file){
  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();
        CosmoSkymedImage cosmo;
        if (obj.getName().equals("String_Node_Str"))         cosmo=new CosmoSkymedImage(f,obj.getName(),null);
 else         cosmo=new CosmoSkymedImage(f,obj.getName() + "String_Node_Str",obj.getName());
        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")) {
      final SumoJaxbSafeReader safeReader=new SumoJaxbSafeReader(f.getAbsolutePath());
      boolean multipleImages=false;
      String[] swath=safeReader.getSwaths();
      if (swath.length > 1)       multipleImages=true;
      Sentinel1 sentinel=null;
      for (      String sw : swath) {
        if (parent.contains("String_Node_Str")) {
          sentinel=new Sentinel1SLC(sw,f);
        }
 else {
          sentinel=new Sentinel1GRD(sw,f);
        }
        sentinel.setContainsMultipleImage(multipleImages);
        if (sentinel.initialise()) {
          logger.info("String_Node_Str",new Object[]{file,sentinel.getClass()});
        }
 else {
          logger.warn("String_Node_Str",new Object[]{file,sentinel.getClass()});
        }
        girList.add(sentinel);
      }
    }
 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")) {
        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 {
        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){
  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")) {
      final SumoJaxbSafeReader safeReader=new SumoJaxbSafeReader(f.getAbsolutePath());
      boolean multipleImages=false;
      String[] swath=safeReader.getSwaths();
      if (swath.length > 1)       multipleImages=true;
      Sentinel1 sentinel=null;
      for (      String sw : swath) {
        if (parent.contains("String_Node_Str")) {
          sentinel=new Sentinel1SLC(sw,f);
        }
 else {
          sentinel=new Sentinel1GRD(sw,f);
        }
        sentinel.setContainsMultipleImage(multipleImages);
        if (sentinel.initialise()) {
          logger.info("String_Node_Str",new Object[]{file,sentinel.getClass()});
        }
 else {
          logger.warn("String_Node_Str",new Object[]{file,sentinel.getClass()});
        }
        girList.add(sentinel);
      }
    }
 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")) {
        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 {
        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;
  }
}