Program: 32074
Project: 32074
Buggy source:
/** 
 * Loading model according to existing model path.
 * @param modelPath the path to store model
 * @param fs file system used to store model
 * @return model object or null if no modelPath file,
 * @throws IOException if loading file for any IOException
 * @throws GuaguaRuntimeException if any exception to load model object and cast to  {@link BasicNetwork}
 */
public static BasicML loadModel(ModelConfig modelConfig,List<ColumnConfig> columnConfigList,Path modelPath,FileSystem fs) throws IOException {
  if (!fs.exists(modelPath)) {
    return null;
  }
  PersistorRegistry.getInstance().add(new PersistBasicFloatNetwork());
  FSDataInputStream stream=null;
  BufferedReader br=null;
  try {
    stream=fs.open(modelPath);
    if (modelPath.getName().endsWith(LogisticRegressionContants.LR_ALG_NAME.toLowerCase())) {
      br=new BufferedReader(new InputStreamReader(stream));
      return LR.loadFromString(br.readLine());
    }
 else     if (modelPath.getName().endsWith(CommonConstants.RF_ALG_NAME.toLowerCase()) || modelPath.getName().endsWith(CommonConstants.GBDT_ALG_NAME.toLowerCase())) {
      return TreeModel.loadFromStream(stream,columnConfigList);
    }
 else {
      return BasicML.class.cast(EncogDirectoryPersistence.loadObject(stream));
    }
  }
 catch (  Exception e) {
    String msg="String_Node_Str" + modelPath;
    throw new ShifuException(ShifuErrorCode.ERROR_FAIL_TO_LOAD_MODEL_FILE,e,msg);
  }
 finally {
    if (br != null) {
      IOUtils.closeQuietly(br);
    }
    if (stream != null) {
      IOUtils.closeQuietly(stream);
    }
  }
}

Fixed version (ground truth):
/** 
 * Loading model according to existing model path.
 * @param modelPath the path to store model
 * @param fs file system used to store model
 * @return model object or null if no modelPath file,
 * @throws IOException if loading file for any IOException
 * @throws GuaguaRuntimeException if any exception to load model object and cast to  {@link BasicNetwork}
 */
public static BasicML loadModel(ModelConfig modelConfig,List<ColumnConfig> columnConfigList,Path modelPath,FileSystem fs) throws IOException {
  if (!fs.exists(modelPath)) {
    return null;
  }
  PersistorRegistry.getInstance().add(new PersistBasicFloatNetwork());
  FSDataInputStream stream=null;
  BufferedReader br=null;
  try {
    stream=fs.open(modelPath);
    if (modelPath.getName().endsWith(LogisticRegressionContants.LR_ALG_NAME.toLowerCase())) {
      br=new BufferedReader(new InputStreamReader(stream));
      return LR.loadFromString(br.readLine());
    }
 else     if (modelPath.getName().endsWith(CommonConstants.RF_ALG_NAME.toLowerCase()) || modelPath.getName().endsWith(CommonConstants.GBDT_ALG_NAME)) {
      return TreeModel.loadFromStream(stream,columnConfigList);
    }
 else {
      return BasicML.class.cast(EncogDirectoryPersistence.loadObject(stream));
    }
  }
 catch (  Exception e) {
    String msg="String_Node_Str" + modelPath;
    throw new ShifuException(ShifuErrorCode.ERROR_FAIL_TO_LOAD_MODEL_FILE,e,msg);
  }
 finally {
    if (br != null) {
      IOUtils.closeQuietly(br);
    }
    if (stream != null) {
      IOUtils.closeQuietly(stream);
    }
  }
}