Program: 115130
Project: 115130
Buggy source:
/** 
 * @pgawade 18-April-2011 - Fix for issue 8394 Copycore\resources\properties\cd_odm_mapping.xml to web application resources outside the core jar file Reason - During CRF data import, Castor API is not able to load this mapping xml file from core jar file
 */
private void copyODMMappingXMLtoResources(ResourceLoader resourceLoader){
  ByteArrayInputStream listSrcFiles[]=new ByteArrayInputStream[10];
  String[] fileNames={"String_Node_Str"};
  try {
    listSrcFiles[0]=(ByteArrayInputStream)resourceLoader.getResource("String_Node_Str" + File.separator + "String_Node_Str").getInputStream();
  }
 catch (  IOException ioe) {
    OpenClinicaSystemException oe=new OpenClinicaSystemException("String_Node_Str");
    oe.initCause(ioe);
    oe.setStackTrace(ioe.getStackTrace());
    logger.debug(ioe.getMessage());
    throw oe;
  }
  File dest=null;
  try {
    File placeholder_file=new File(resourceLoader.getResource("String_Node_Str" + File.separator + "String_Node_Str").getURL().getFile());
    String placeholder_file_path=placeholder_file.getPath();
    String tmp1=placeholder_file_path.substring(6);
    String tmp2=tmp1.substring(0,tmp1.indexOf("String_Node_Str") - 1);
    String tmp3=tmp2 + File.separator + "String_Node_Str"+ File.separator+ "String_Node_Str";
    dest=new File(tmp3 + File.separator + "String_Node_Str");
  }
 catch (  IOException ioe) {
    OpenClinicaSystemException oe=new OpenClinicaSystemException("String_Node_Str");
    oe.initCause(ioe);
    oe.setStackTrace(ioe.getStackTrace());
    throw oe;
  }
  if (!dest.exists()) {
    if (!dest.mkdirs()) {
      throw new OpenClinicaSystemException("String_Node_Str" + dest.getAbsolutePath() + "String_Node_Str");
    }
  }
  for (int i=0; i < fileNames.length; i++) {
    File dest1=new File(dest,fileNames[i]);
    if (listSrcFiles[i] != null)     copyFiles(listSrcFiles[i],dest1);
  }
}

Fixed version (ground truth):
/** 
 * @pgawade 18-April-2011 - Fix for issue 8394 Copycore\resources\properties\cd_odm_mapping.xml to web application resources outside the core jar file Reason - During CRF data import, Castor API is not able to load this mapping xml file from core jar file
 */
private void copyODMMappingXMLtoResources(ResourceLoader resourceLoader){
  ByteArrayInputStream listSrcFiles[]=new ByteArrayInputStream[10];
  String[] fileNames={"String_Node_Str"};
  try {
    listSrcFiles[0]=(ByteArrayInputStream)resourceLoader.getResource("String_Node_Str" + File.separator + "String_Node_Str").getInputStream();
  }
 catch (  IOException ioe) {
    OpenClinicaSystemException oe=new OpenClinicaSystemException("String_Node_Str");
    oe.initCause(ioe);
    oe.setStackTrace(ioe.getStackTrace());
    logger.debug(ioe.getMessage());
    throw oe;
  }
  File dest=null;
  try {
    File placeholder_file=new File(resourceLoader.getResource("String_Node_Str").getURL().getFile());
    String placeholder_file_path=placeholder_file.getPath();
    String tmp2=placeholder_file_path.substring(0,placeholder_file_path.indexOf("String_Node_Str") - 1);
    String tmp3=tmp2 + File.separator + "String_Node_Str"+ File.separator+ "String_Node_Str";
    dest=new File(tmp3 + File.separator + "String_Node_Str");
  }
 catch (  IOException ioe) {
    OpenClinicaSystemException oe=new OpenClinicaSystemException("String_Node_Str");
    oe.initCause(ioe);
    oe.setStackTrace(ioe.getStackTrace());
    throw oe;
  }
  if (!dest.exists()) {
    if (!dest.mkdirs()) {
      throw new OpenClinicaSystemException("String_Node_Str" + dest.getAbsolutePath() + "String_Node_Str");
    }
  }
  for (int i=0; i < fileNames.length; i++) {
    File dest1=new File(dest,fileNames[i]);
    if (listSrcFiles[i] != null)     copyFiles(listSrcFiles[i],dest1);
  }
}