Program: 31803
Project: 31803
Buggy source:
/** 
 * Loading model according to existing model path.
 * @param modelConfig model config
 * @param columnConfigList list of column config
 * @param modelPath the path to store model
 * @param fs file system used to store model
 * @param gbtConvertToProb convert gbt score to prob or not
 * @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 BasicNetwork
 */
public static BasicML loadModel(ModelConfig modelConfig,List<ColumnConfig> columnConfigList,Path modelPath,FileSystem fs,boolean gbtConvertToProb) 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.GBT_ALG_NAME.toLowerCase())) {
      return TreeModel.loadFromStream(stream,gbtConvertToProb);
    }
 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 modelConfig model config
 * @param columnConfigList list of column config
 * @param modelPath the path to store model
 * @param fs file system used to store model
 * @param gbtConvertToProb convert gbt score to prob or not
 * @return model object or null if no modelPath file,
 * @throws IOException if loading file for any IOException
 */
public static BasicML loadModel(ModelConfig modelConfig,List<ColumnConfig> columnConfigList,Path modelPath,FileSystem fs,boolean gbtConvertToProb) 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.GBT_ALG_NAME.toLowerCase())) {
      return TreeModel.loadFromStream(stream,gbtConvertToProb);
    }
 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);
    }
  }
}