private synchronized void writeBadRecordsToCSVFile(StringBuilder logStrings){
  if (null == csvFilePath) {
    csvFilePath=this.storePath + File.separator + this.fileName+ CarbonCommonConstants.CSV_FILE_EXTENSION+ CarbonCommonConstants.FILE_INPROGRESS_STATUS;
  }
  try {
    if (null == bufferedCSVWriter) {
      FileType fileType=FileFactory.getFileType(storePath);
      if (!FileFactory.isFileExist(this.storePath,fileType)) {
        FileFactory.mkdirs(this.storePath,fileType);
        FileFactory.createNewFile(csvFilePath,fileType);
      }
      outCSVStream=FileFactory.getDataOutputStream(csvFilePath,fileType);
      bufferedCSVWriter=new BufferedWriter(new OutputStreamWriter(outCSVStream,Charset.forName(CarbonCommonConstants.DEFAULT_CHARSET)));
    }
    bufferedCSVWriter.write(logStrings.toString());
    bufferedCSVWriter.newLine();
  }
 catch (  FileNotFoundException e) {
    LOGGER.error("Bad record csv Files not found");
  }
catch (  IOException e) {
    LOGGER.error("Error While writing bad record csv File");
  }
 finally {
    badRecordEntry.put(taskKey,"Partially");
  }
}

private synchronized void writeBadRecordsToCSVFile ( StringBuilder logStrings ) { if ( null == csvFilePath ) { csvFilePath = this . storePath + File . separator + this . fileName + CarbonCommonConstants . CSV_FILE_EXTENSION + CarbonCommonConstants . FILE_INPROGRESS_STATUS ; } try { if ( null == bufferedCSVWriter ) { FileType fileType = FileFactory . getFileType ( storePath ) ; if ( ! FileFactory . isFileExist ( this . storePath , fileType ) ) { FileFactory . mkdirs ( this . storePath , fileType ) ; FileFactory . createNewFile ( csvFilePath , fileType ) ; } outCSVStream = FileFactory . getDataOutputStream ( csvFilePath , fileType ) ; bufferedCSVWriter = new BufferedWriter ( new OutputStreamWriter ( outCSVStream , Charset . forName ( CarbonCommonConstants . DEFAULT_CHARSET ) ) ) ; } bufferedCSVWriter . write ( logStrings . toString ( ) ) ; bufferedCSVWriter . newLine ( ) ; } catch ( FileNotFoundException e ) { LOGGER . error ( "Bad record csv Files not found" ) ; } catch ( IOException e ) { LOGGER . error ( "Error While writing bad record csv File" ) ; } finally { badRecordEntry . put ( taskKey , "Partially" ) ; } }
method will write the row having bad record in the csv file .
