nus-yam/ex-repair huggingface dataset:
Program: 163324
Project: 163324
Buggy source:
/** 
 * Attempts to collect a   {@code String} from the current position until a stop character is found on the input,or a line ending is reached. If the  {@code String} can be obtained, the current position of the parser will be updated tothe last consumed character. If the internal buffer needs to be reloaded, this method will return  {@code null}and the current position of the buffer will remain unchanged.
 * @param ch the current character to be considered. If equal to the stop character the {@code nullValue} will be returned
 * @param stop the stop character that identifies the end of the content to be collected
 * @param trim flag indicating whether or not trailing whitespaces should be discarded
 * @param nullValue value to return when the length of the content to be returned is {@code 0}.
 * @return the {@code String} found on the input, or {@code null} if the buffer needs to reloaded.
 */
String getString(char ch,char stop,boolean trim,String nullValue);

Fixed version (ground truth):
/** 
 * Attempts to collect a   {@code String} from the current position until a stop character is found on the input,or a line ending is reached. If the  {@code String} can be obtained, the current position of the parser will be updated tothe last consumed character. If the internal buffer needs to be reloaded, this method will return  {@code null}and the current position of the buffer will remain unchanged.
 * @param ch        the current character to be considered. If equal to the stop character the {@code nullValue} will be returned
 * @param stop      the stop character that identifies the end of the content to be collected
 * @param trim      flag indicating whether or not trailing whitespaces should be discarded
 * @param nullValue value to return when the length of the content to be returned is {@code 0}.
 * @param maxLength the maximum length of the {@code String} to be returned. If the length exceeds this limit, {@code null} will be returned
 * @return the {@code String} found on the input, or {@code null} if the buffer needs to reloaded or the maximum length has been exceeded.
 */
String getString(char ch,char stop,boolean trim,String nullValue,int maxLength);
Program: 163325
Project: 163325
Buggy source:
/** 
 * Skips characters from the current input position, until a non-whitespace character, or a stop character is found
 * @param current the current character of the input
 * @param stopChar1 the first stop character (which can be a whitespace)
 * @param stopChar2 the second character (which can be a whitespace)
 * @return the first non-whitespace character (or delimiter) found in the input.
 */
char skipWhitespace(char current,char stopChar1,char stopChar2);

Fixed version (ground truth):
/** 
 * Skips characters from the current input position, until a non-whitespace character, or a stop character is found
 * @param current   the current character of the input
 * @param stopChar1 the first stop character (which can be a whitespace)
 * @param stopChar2 the second character (which can be a whitespace)
 * @return the first non-whitespace character (or delimiter) found in the input.
 */
char skipWhitespace(char current,char stopChar1,char stopChar2);
Program: 163326
Project: 163326
Buggy source:
@Override public String getString(char ch,char stop,boolean trim,String nullValue){
  return reader.getString(ch,stop,trim,nullValue);
}

Fixed version (ground truth):
@Override public String getString(char ch,char stop,boolean trim,String nullValue,int maxLength){
  return reader.getString(ch,stop,trim,nullValue,maxLength);
}
Program: 163327
Project: 163327
Buggy source:
@Override protected final void parseRecord(){
  if (ch <= ' ' && ignoreLeadingWhitespace) {
    ch=input.skipWhitespace(ch,delimiter,quote);
  }
  while (ch != newLine) {
    if (ch <= ' ' && ignoreLeadingWhitespace) {
      ch=input.skipWhitespace(ch,delimiter,quote);
    }
    if (ch == delimiter || ch == newLine) {
      output.emptyParsed();
    }
 else {
      prev='\0';
      if (ch == quote) {
        output.trim=false;
        if (normalizeLineEndingsInQuotes) {
          parseQuotedValue();
        }
 else {
          input.enableNormalizeLineEndings(false);
          parseQuotedValue();
          input.enableNormalizeLineEndings(true);
        }
        output.valueParsed();
      }
 else       if (doNotEscapeUnquotedValues) {
        String value=null;
        if (output.appender.length() == 0) {
          value=input.getString(ch,delimiter,ignoreTrailingWhitespace,nullValue);
        }
        if (value != null) {
          output.valueParsed(value);
          ch=input.getChar();
        }
 else {
          output.trim=ignoreTrailingWhitespace;
          ch=output.appender.appendUntil(ch,input,delimiter,newLine);
          output.valueParsed();
        }
      }
 else {
        output.trim=ignoreTrailingWhitespace;
        parseValueProcessingEscape();
        output.valueParsed();
      }
    }
    if (ch != newLine) {
      ch=input.nextChar();
      if (ch == newLine) {
        output.emptyParsed();
      }
    }
  }
}

Fixed version (ground truth):
@Override protected final void parseRecord(){
  if (ch <= ' ' && ignoreLeadingWhitespace) {
    ch=input.skipWhitespace(ch,delimiter,quote);
  }
  while (ch != newLine) {
    if (ch <= ' ' && ignoreLeadingWhitespace) {
      ch=input.skipWhitespace(ch,delimiter,quote);
    }
    if (ch == delimiter || ch == newLine) {
      output.emptyParsed();
    }
 else {
      prev='\0';
      if (ch == quote) {
        output.trim=false;
        if (normalizeLineEndingsInQuotes) {
          parseQuotedValue();
        }
 else {
          input.enableNormalizeLineEndings(false);
          parseQuotedValue();
          input.enableNormalizeLineEndings(true);
        }
        output.valueParsed();
      }
 else       if (doNotEscapeUnquotedValues) {
        String value=null;
        if (output.appender.length() == 0) {
          value=input.getString(ch,delimiter,ignoreTrailingWhitespace,nullValue,maxColumnLength);
        }
        if (value != null) {
          output.valueParsed(value);
          ch=input.getChar();
        }
 else {
          output.trim=ignoreTrailingWhitespace;
          ch=output.appender.appendUntil(ch,input,delimiter,newLine);
          output.valueParsed();
        }
      }
 else {
        output.trim=ignoreTrailingWhitespace;
        parseValueProcessingEscape();
        output.valueParsed();
      }
    }
    if (ch != newLine) {
      ch=input.nextChar();
      if (ch == newLine) {
        output.emptyParsed();
      }
    }
  }
}
Program: 163329
Project: 163329
Buggy source:
@Override public void markRecordStart(){
  tmp.reset();
  recordStart=i - 1;
}

Fixed version (ground truth):
@Override public void markRecordStart(){
  tmp.reset();
  recordStart=i <= 0 ? 0 : i - 1;
}
Program: 163330
Project: 163330
Buggy source:
/** 
 * Requests the next batch of characters from the implementing class and updates the character count. <p> If there are no more characters in the input, the reading will stop by invoking the   {@link AbstractCharInputReader#stop()} method.
 */
private void updateBuffer(){
  if (length - recordStart > 0 && buffer != null) {
    tmp.append(buffer,recordStart,length - recordStart);
  }
  reloadBuffer();
  charCount+=i;
  i=0;
  if (length == -1) {
    stop();
    incrementLineCount=true;
  }
  if (inputAnalysisProcesses != null) {
    try {
      for (      InputAnalysisProcess process : inputAnalysisProcesses) {
        process.execute(buffer,length);
      }
    }
  finally {
      inputAnalysisProcesses=null;
    }
  }
}

Fixed version (ground truth):
/** 
 * Requests the next batch of characters from the implementing class and updates the character count. <p> If there are no more characters in the input, the reading will stop by invoking the   {@link AbstractCharInputReader#stop()} method.
 */
private void updateBuffer(){
  if (length - recordStart > 0 && buffer != null) {
    tmp.append(buffer,recordStart,length - recordStart);
  }
  recordStart=0;
  reloadBuffer();
  charCount+=i;
  i=0;
  if (length == -1) {
    stop();
    incrementLineCount=true;
  }
  if (inputAnalysisProcesses != null) {
    try {
      for (      InputAnalysisProcess process : inputAnalysisProcesses) {
        process.execute(buffer,length);
      }
    }
  finally {
      inputAnalysisProcesses=null;
    }
  }
}
Program: 163332
Project: 163332
Buggy source:
/** 
 * Parses a single line from a String in the format supported by the parser implementation.
 * @param line a line of text to be parsed
 * @return the values parsed from the input line
 */
public final String[] parseLine(String line){
  if (line == null || line.isEmpty()) {
    return null;
  }
  lineReader.setLine(line);
  if (context == null || context.isStopped()) {
    beginParsing(lineReader);
  }
 else {
    ((DefaultCharInputReader)input).reloadBuffer();
  }
  try {
    while (!context.isStopped()) {
      ch=input.nextChar();
      if (inComment()) {
        processComment();
        return null;
      }
      parseRecord();
      String[] row=output.rowParsed();
      if (row != null) {
        rowProcessed(row);
        return row;
      }
    }
    return null;
  }
 catch (  EOFException ex) {
    return handleEOF();
  }
catch (  NullPointerException ex) {
    if (input != null) {
      stopParsing(null);
    }
    throw new IllegalStateException("String_Node_Str",ex);
  }
catch (  Throwable ex) {
    try {
      ex=handleException(ex);
    }
  finally {
      stopParsing(ex);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Parses a single line from a String in the format supported by the parser implementation.
 * @param line a line of text to be parsed
 * @return the values parsed from the input line
 */
public final String[] parseLine(String line){
  if (line == null || line.isEmpty()) {
    return null;
  }
  lineReader.setLine(line);
  if (context == null || context.isStopped()) {
    beginParsing(lineReader);
  }
 else {
    ((DefaultCharInputReader)input).reloadBuffer();
  }
  try {
    while (!context.isStopped()) {
      ch=input.nextChar();
      if (inComment()) {
        processComment();
        return null;
      }
      input.markRecordStart();
      parseRecord();
      String[] row=output.rowParsed();
      if (row != null) {
        rowProcessed(row);
        return row;
      }
    }
    return null;
  }
 catch (  EOFException ex) {
    return handleEOF();
  }
catch (  NullPointerException ex) {
    if (input != null) {
      stopParsing(null);
    }
    throw new IllegalStateException("String_Node_Str",ex);
  }
catch (  Throwable ex) {
    try {
      ex=handleException(ex);
    }
  finally {
      stopParsing(ex);
    }
  }
  return null;
}
Program: 163333
Project: 163333
Buggy source:
@Override public String currentParsedContent(){
  char[] chars=output.appender.getChars();
  if (chars != null) {
    int length=output.appender.length();
    if (length > chars.length) {
      length=chars.length;
    }
    if (length > 0) {
      return new String(chars,0,length);
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public String currentParsedContent(){
  if (input != null) {
    return input.currentParsedContent();
  }
  return null;
}
Program: 163334
Project: 163334
Buggy source:
private void setParsingContext(ParsingContext parsingContext){
  this.lineIndex=parsingContext == null ? -1L : parsingContext.currentLine();
  this.charIndex=parsingContext == null ? '\0' : parsingContext.currentChar();
  this.content=parsingContext == null ? null : parsingContext.currentParsedContent();
}

Fixed version (ground truth):
private void setParsingContext(ParsingContext parsingContext){
  this.lineIndex=parsingContext == null ? -1L : parsingContext.currentLine();
  this.charIndex=parsingContext == null ? '\0' : parsingContext.currentChar();
  this.content=parsingContext == null ? null : parsingContext.fieldContentOnError();
}
Program: 163335
Project: 163335
Buggy source:
/** 
 * Requests the next batch of characters from the implementing class and updates the character count. <p> If there are no more characters in the input, the reading will stop by invoking the   {@link AbstractCharInputReader#stop()} method.
 */
private void updateBuffer(){
  reloadBuffer();
  charCount+=i;
  i=0;
  if (length == -1) {
    stop();
    incrementLineCount=true;
  }
  if (inputAnalysisProcesses != null) {
    try {
      for (      InputAnalysisProcess process : inputAnalysisProcesses) {
        process.execute(buffer,length);
      }
    }
  finally {
      inputAnalysisProcesses=null;
    }
  }
}

Fixed version (ground truth):
/** 
 * Requests the next batch of characters from the implementing class and updates the character count. <p> If there are no more characters in the input, the reading will stop by invoking the   {@link AbstractCharInputReader#stop()} method.
 */
private void updateBuffer(){
  if (length - recordStart > 0 && buffer != null) {
    tmp.append(buffer,recordStart,length - recordStart);
  }
  reloadBuffer();
  charCount+=i;
  i=0;
  if (length == -1) {
    stop();
    incrementLineCount=true;
  }
  if (inputAnalysisProcesses != null) {
    try {
      for (      InputAnalysisProcess process : inputAnalysisProcesses) {
        process.execute(buffer,length);
      }
    }
  finally {
      inputAnalysisProcesses=null;
    }
  }
}
Program: 163336
Project: 163336
Buggy source:
@Override public String readComment(){
  long expectedLineCount=lineCount + 1;
  try {
    do {
      char ch=nextChar();
      if (ch <= ' ') {
        ch=skipWhitespace(ch,normalizedLineSeparator,normalizedLineSeparator);
      }
      commentBuilder.appendUntil(ch,this,normalizedLineSeparator,normalizedLineSeparator);
      if (lineCount < expectedLineCount) {
        commentBuilder.appendIgnoringWhitespace(nextChar());
      }
 else {
        commentBuilder.updateWhitespace();
        return commentBuilder.getAndReset();
      }
    }
 while (true);
  }
 catch (  EOFException ex) {
    commentBuilder.updateWhitespace();
    return commentBuilder.getAndReset();
  }
}

Fixed version (ground truth):
@Override public String readComment(){
  long expectedLineCount=lineCount + 1;
  try {
    do {
      char ch=nextChar();
      if (ch <= ' ') {
        ch=skipWhitespace(ch,normalizedLineSeparator,normalizedLineSeparator);
      }
      tmp.appendUntil(ch,this,normalizedLineSeparator,normalizedLineSeparator);
      if (lineCount < expectedLineCount) {
        tmp.appendIgnoringWhitespace(nextChar());
      }
 else {
        tmp.updateWhitespace();
        return tmp.getAndReset();
      }
    }
 while (true);
  }
 catch (  EOFException ex) {
    tmp.updateWhitespace();
    return tmp.getAndReset();
  }
}
Program: 163337
Project: 163337
Buggy source:
/** 
 * Appends the given character.
 * @param ch the character to append
 */
void append(char ch);

Fixed version (ground truth):
/** 
 * Appends characters from an input array
 * @param ch the character array
 * @param from the position of the first character in the array to be appended
 * @param length the number of characters to be appended from the given posiion.
 */
void append(char[] ch,int from,int length);
Program: 163338
Project: 163338
Buggy source:
/** 
 * Appends the contents of another DefaultCharAppender, discarding any of its trailing whitespace characters
 * @param appender The DefaultCharAppender instance got get contents from.
 */
public void append(DefaultCharAppender appender){
  System.arraycopy(appender.chars,0,this.chars,this.index,appender.index - appender.whitespaceCount);
  this.index+=appender.index - appender.whitespaceCount;
  appender.reset();
}

Fixed version (ground truth):
@Override public void append(char[] ch,int from,int length){
  System.arraycopy(ch,from,chars,index,length);
  index+=length;
}
Program: 163339
Project: 163339
Buggy source:
public final void append(DefaultCharAppender appender){
  try {
    super.append(appender);
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    expand(appender.index);
    this.append(appender);
  }
}

Fixed version (ground truth):
@Override public void append(char[] ch,int from,int length){
  if (index + length <= chars.length) {
    super.append(ch,from,length);
  }
 else {
    chars=Arrays.copyOf(chars,Math.min(((chars.length + length + index)),MAX_ARRAY_LENGTH));
    super.append(ch,from,length);
  }
}
Program: 163340
Project: 163340
Buggy source:
/** 
 * Does nothing
 */
@Override public void append(char ch){
}

Fixed version (ground truth):
/** 
 * Does nothing
 */
@Override public void append(char[] ch,int from,int length){
}
Program: 163341
Project: 163341
Buggy source:
@Test(enabled=true,dataProvider="String_Node_Str") public void parseColumns(String csvFile,char[] lineSeparator) throws Exception {
  CsvParserSettings settings=newCsvInputSettings(lineSeparator);
  settings.setRowProcessor(processor);
  settings.setHeaderExtractionEnabled(true);
  settings.setIgnoreLeadingWhitespaces(true);
  settings.setIgnoreTrailingWhitespaces(true);
  settings.selectFields("String_Node_Str");
  settings.setColumnReorderingEnabled(true);
  CsvParser parser=new CsvParser(settings);
  parser.parse(newReader(csvFile));
  String[] expectedHeaders=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  String[][] expectedResult=new String[][]{{"String_Node_Str",null,null,null,null},{"String_Node_Str",null,null,null,null},{"String_Node_Str",null,null,null,null},{"String_Node_Str",null,null,null,null},{null,null,null,null,null},{null,null,null,null,null},{null,null,null,null,null},{null,null,null,null,null},{"String_Node_Str",null,null,null,null},{"String_Node_Str",null,null,null,null},{"String_Node_Str",null,null,null,null},{"String_Node_Str",null,null,null,null},{null,null,null,null,null},{"String_Node_Str",null,null,null,null},{"String_Node_Str",null,null,null,null}};
  assertHeadersAndValuesMatch(expectedHeaders,expectedResult);
}

Fixed version (ground truth):
@Test(enabled=true,dataProvider="String_Node_Str") public void parseColumns(String csvFile,char[] lineSeparator) throws Exception {
  CsvParserSettings settings=newCsvInputSettings(lineSeparator);
  settings.setRowProcessor(processor);
  settings.setHeaderExtractionEnabled(true);
  settings.setIgnoreLeadingWhitespaces(true);
  settings.setIgnoreTrailingWhitespaces(true);
  settings.selectFields("String_Node_Str");
  settings.setColumnReorderingEnabled(false);
  CsvParser parser=new CsvParser(settings);
  parser.parse(newReader(csvFile));
  String[] expectedHeaders=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  String[][] expectedResult=new String[][]{{"String_Node_Str",null,null,null,null},{"String_Node_Str",null,null,null,null},{"String_Node_Str",null,null,null,null},{"String_Node_Str",null,null,null,null},{null,null,null,null,null},{null,null,null,null,null},{null,null,null,null,null},{null,null,null,null,null},{"String_Node_Str",null,null,null,null},{"String_Node_Str",null,null,null,null},{"String_Node_Str",null,null,null,null},{"String_Node_Str",null,null,null,null},{null,null,null,null,null},{"String_Node_Str",null,null,null,null},{"String_Node_Str",null,null,null,null}};
  assertHeadersAndValuesMatch(expectedHeaders,expectedResult);
}
Program: 163342
Project: 163342
Buggy source:
private static boolean isCustomAnnotation(Annotation annotation){
  Class annotationType=annotation.annotationType();
  boolean isCustom=customAnnotationTypes.contains(annotationType);
  if (isCustom) {
    return false;
  }
  boolean isJavaLang=javaLangAnnotationTypes.contains(annotationType);
  if (isJavaLang) {
    return true;
  }
  isJavaLang=annotationType.getName().startsWith("String_Node_Str");
  if (isJavaLang) {
    javaLangAnnotationTypes.add(annotationType);
  }
 else {
    customAnnotationTypes.add(annotationType);
  }
  return isJavaLang;
}

Fixed version (ground truth):
private static boolean isCustomAnnotation(Annotation annotation){
  Class annotationType=annotation.annotationType();
  if (customAnnotationTypes.contains(annotationType)) {
    return true;
  }
  if (javaLangAnnotationTypes.contains(annotationType)) {
    return false;
  }
  if (annotationType.getName().startsWith("String_Node_Str")) {
    javaLangAnnotationTypes.add(annotationType);
    return false;
  }
 else {
    customAnnotationTypes.add(annotationType);
    return true;
  }
}
Program: 163346
Project: 163346
Buggy source:
/** 
 * Converts a String to a Boolean
 * @param input a String to be converted into a Boolean value.
 * @return true if the input String is part of {@link BooleanConversion#trueValues}, false if the input String is part of   {@link BooleanConversion#falseValues}, or   {@link BooleanConversion#getValueIfStringIsNull()} if the input String is null.
 */
@Override protected Boolean fromString(String input){
  if (input != null) {
    String normalized=ArgumentUtils.normalize(input);
    if (falseValues.contains(normalized)) {
      return Boolean.FALSE;
    }
    if (trueValues.contains(normalized)) {
      return Boolean.TRUE;
    }
    DataProcessingException exception=new DataProcessingException("String_Node_Str" + trueValues + "String_Node_Str"+ falseValues+ "String_Node_Str");
    exception.setValue(input);
    throw exception;
  }
  return super.getValueIfStringIsNull();
}

Fixed version (ground truth):
/** 
 * Converts a String to a Boolean
 * @param input a String to be converted into a Boolean value.
 * @return true if the input String is part of {@link BooleanConversion#trueValues}, false if the input String is part of   {@link BooleanConversion#falseValues}, or   {@link BooleanConversion#getValueIfStringIsNull()} if the input String is null.
 */
@Override protected Boolean fromString(String input){
  if (input != null) {
    return getBoolean(input,trueValues,falseValues);
  }
  return super.getValueIfStringIsNull();
}
Program: 163348
Project: 163348
Buggy source:
public MetaData getMetaData(int index){
  if (indexMap == null || indexMap.length < index) {
    int startFrom=0;
    int lastIndex=index;
    if (indexMap != null) {
      startFrom=indexMap.length;
      indexMap=Arrays.copyOf(indexMap,index);
    }
 else {
      String[] headers=context.headers();
      if (headers != null && lastIndex < headers.length) {
        lastIndex=headers.length;
      }
      int[] indexes=context.extractedFieldIndexes();
      if (indexes != null) {
        for (int i=0; i < indexes.length; i++) {
          if (lastIndex < indexes[i]) {
            lastIndex=indexes[i];
          }
        }
      }
      indexMap=new MetaData[lastIndex];
    }
    for (int i=startFrom; i < lastIndex; i++) {
      indexMap[i]=new MetaData(i);
    }
  }
  return indexMap[index];
}

Fixed version (ground truth):
public MetaData getMetaData(int index){
  if (indexMap == null || indexMap.length < index + 1) {
    int startFrom=0;
    int lastIndex=index;
    if (indexMap != null) {
      startFrom=indexMap.length;
      indexMap=Arrays.copyOf(indexMap,index + 1);
    }
 else {
      String[] headers=context.headers();
      if (headers != null && lastIndex < headers.length) {
        lastIndex=headers.length;
      }
      int[] indexes=context.extractedFieldIndexes();
      if (indexes != null) {
        for (int i=0; i < indexes.length; i++) {
          if (lastIndex < indexes[i]) {
            lastIndex=indexes[i];
          }
        }
      }
      indexMap=new MetaData[lastIndex + 1];
    }
    for (int i=startFrom; i < lastIndex + 1; i++) {
      indexMap[i]=new MetaData(i);
    }
  }
  return indexMap[index];
}
Program: 163349
Project: 163349
Buggy source:
private String[] handleEOF(){
  String[] row=null;
  try {
    if (output.column != 0) {
      if (output.appender.length() > 0) {
        output.valueParsed();
      }
 else {
        output.emptyParsed();
      }
      row=output.rowParsed();
    }
 else     if (output.appender.length() > 0) {
      output.valueParsed();
      row=output.rowParsed();
    }
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    throw handleException(e);
  }
  if (row != null) {
    rowProcessed(row);
  }
  return row;
}

Fixed version (ground truth):
private String[] handleEOF(){
  String[] row=null;
  try {
    boolean consumeValueOnEOF=consumeValueOnEOF();
    if (output.column != 0 || consumeValueOnEOF) {
      if (output.appender.length() > 0 || consumeValueOnEOF) {
        output.valueParsed();
      }
 else {
        output.emptyParsed();
      }
      row=output.rowParsed();
    }
 else     if (output.appender.length() > 0) {
      output.valueParsed();
      row=output.rowParsed();
    }
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    throw handleException(e);
  }
  if (row != null) {
    rowProcessed(row);
  }
  return row;
}
Program: 163350
Project: 163350
Buggy source:
@Override protected void parseRecord(){
  if (ch <= ' ' && ignoreLeadingWhitespace) {
    ch=input.skipWhitespace(ch);
  }
  while (ch != newLine) {
    if (ch <= ' ' && ignoreLeadingWhitespace) {
      ch=input.skipWhitespace(ch);
    }
    if (ch == delimiter) {
      output.emptyParsed();
    }
 else {
      if (ch == quote) {
        output.trim=false;
        if (normalizeLineEndingsInQuotes) {
          parseQuotedValue('\0');
        }
 else {
          input.enableNormalizeLineEndings(false);
          parseQuotedValue('\0');
          input.enableNormalizeLineEndings(true);
        }
      }
 else       if (doNotEscapeUnquotedValues) {
        output.trim=ignoreTrailingWhitespace;
        ch=input.appendUntilDelimiter(ch,output.appender);
      }
 else {
        output.trim=ignoreTrailingWhitespace;
        parseValueProcessingEscape('\0');
      }
      output.valueParsed();
    }
    if (ch != newLine) {
      ch=input.nextChar();
      if (ch == newLine) {
        output.emptyParsed();
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void parseRecord(){
  if (ch <= ' ' && ignoreLeadingWhitespace) {
    ch=input.skipWhitespace(ch);
  }
  while (ch != newLine) {
    if (ch <= ' ' && ignoreLeadingWhitespace) {
      ch=input.skipWhitespace(ch);
    }
    if (ch == delimiter) {
      output.emptyParsed();
    }
 else {
      prev='\0';
      if (ch == quote) {
        output.trim=false;
        if (normalizeLineEndingsInQuotes) {
          parseQuotedValue();
        }
 else {
          input.enableNormalizeLineEndings(false);
          parseQuotedValue();
          input.enableNormalizeLineEndings(true);
        }
      }
 else       if (doNotEscapeUnquotedValues) {
        output.trim=ignoreTrailingWhitespace;
        ch=input.appendUntilDelimiter(ch,output.appender);
      }
 else {
        output.trim=ignoreTrailingWhitespace;
        parseValueProcessingEscape();
      }
      output.valueParsed();
    }
    if (ch != newLine) {
      ch=input.nextChar();
      if (ch == newLine) {
        output.emptyParsed();
      }
    }
  }
}
Program: 163351
Project: 163351
Buggy source:
private void parseValueProcessingEscape(char prev){
  while (ch != delimiter && ch != newLine) {
    if (ch != quote && ch != quoteEscape) {
      if (prev == quote) {
        handleUnescapedQuoteInValue();
        break;
      }
      output.appender.append(ch);
    }
 else     if (ch == quoteEscape && prev == escapeEscape && escapeEscape != '\0') {
      if (keepEscape) {
        output.appender.append(escapeEscape);
      }
      output.appender.append(quoteEscape);
      ch='\0';
    }
 else     if (prev == quoteEscape) {
      if (ch == quote) {
        if (keepEscape) {
          output.appender.append(quoteEscape);
        }
        output.appender.append(quote);
        ch='\0';
      }
 else {
        output.appender.append(prev);
      }
    }
 else     if (ch == quote && prev == quote) {
      output.appender.append(quote);
    }
    prev=ch;
    ch=input.nextChar();
  }
}

Fixed version (ground truth):
private void parseValueProcessingEscape(){
  while (ch != delimiter && ch != newLine) {
    if (ch != quote && ch != quoteEscape) {
      if (prev == quote) {
        handleUnescapedQuoteInValue();
        break;
      }
      output.appender.append(ch);
    }
 else     if (ch == quoteEscape && prev == escapeEscape && escapeEscape != '\0') {
      if (keepEscape) {
        output.appender.append(escapeEscape);
      }
      output.appender.append(quoteEscape);
      ch='\0';
    }
 else     if (prev == quoteEscape) {
      if (ch == quote) {
        if (keepEscape) {
          output.appender.append(quoteEscape);
        }
        output.appender.append(quote);
        ch='\0';
      }
 else {
        output.appender.append(prev);
      }
    }
 else     if (ch == quote && prev == quote) {
      output.appender.append(quote);
    }
    prev=ch;
    ch=input.nextChar();
  }
}
Program: 163353
Project: 163353
Buggy source:
private boolean handleUnescapedQuote(){
switch (quoteHandling) {
case STOP_AT_CLOSING_QUOTE:
case STOP_AT_DELIMITER:
    output.appender.append(quote);
  output.appender.append(ch);
parseQuotedValue(ch);
return true;
default :
handleValueSkipping(true);
return false;
}
}

Fixed version (ground truth):
private boolean handleUnescapedQuote(){
switch (quoteHandling) {
case STOP_AT_CLOSING_QUOTE:
case STOP_AT_DELIMITER:
    output.appender.append(quote);
  output.appender.append(ch);
prev=ch;
parseQuotedValue();
return true;
default :
handleValueSkipping(true);
return false;
}
}
Program: 163354
Project: 163354
Buggy source:
private void handleUnescapedQuoteInValue(){
switch (quoteHandling) {
case STOP_AT_CLOSING_QUOTE:
case STOP_AT_DELIMITER:
    output.appender.append(quote);
  parseValueProcessingEscape(ch);
break;
default :
handleValueSkipping(false);
break;
}
}

Fixed version (ground truth):
private void handleUnescapedQuoteInValue(){
switch (quoteHandling) {
case STOP_AT_CLOSING_QUOTE:
case STOP_AT_DELIMITER:
    output.appender.append(quote);
  prev=ch;
parseValueProcessingEscape();
break;
default :
handleValueSkipping(false);
break;
}
}
Program: 163355
Project: 163355
Buggy source:
@Test(dataProvider="String_Node_Str") public void testWriteBlanks(boolean quoteAllFields,String nullValue,String expectedResult){
  CsvWriterSettings s=new CsvWriterSettings();
  s.setQuoteAllFields(quoteAllFields);
  s.getFormat().setLineSeparator("String_Node_Str");
  s.setNullValue(nullValue);
  s.setEmptyValue("String_Node_Str");
  CsvWriter w=new CsvWriter(s);
  CsvParserSettings ps=new CsvParserSettings();
  ps.setNullValue(nullValue);
  ps.setEmptyValue("String_Node_Str");
  CsvParser p=new CsvParser(ps);
  String result=w.writeRowToString("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",null);
  assertEquals(result,expectedResult);
  String[] row=p.parseLine(result);
  if (quoteAllFields) {
    assertEquals(row[0],"String_Node_Str");
    assertEquals(row[1],"String_Node_Str");
  }
 else {
    assertEquals(row[0],nullValue);
    assertEquals(row[1],nullValue);
  }
  assertEquals(row[2],"String_Node_Str");
  assertEquals(row[3],"String_Node_Str");
  assertEquals(row[4],nullValue);
}

Fixed version (ground truth):
@Test(dataProvider="String_Node_Str") public void testWriteBlanks(boolean quoteAllFields,String nullValue,String expectedResult){
  CsvWriterSettings s=new CsvWriterSettings();
  s.setQuoteAllFields(quoteAllFields);
  s.getFormat().setLineSeparator("String_Node_Str");
  s.setNullValue(nullValue);
  s.setEmptyValue("String_Node_Str");
  CsvWriter w=new CsvWriter(s);
  CsvParserSettings ps=new CsvParserSettings();
  ps.setNullValue(nullValue);
  ps.setEmptyValue("String_Node_Str");
  CsvParser p=new CsvParser(ps);
  String result=w.writeRowToString("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",null);
  assertEquals(result,expectedResult);
  String[] row=p.parseLine(result);
  if (quoteAllFields) {
    assertEquals(row[0],"String_Node_Str");
    assertEquals(row[1],"String_Node_Str");
    assertEquals(row[4],"String_Node_Str");
  }
 else {
    assertEquals(row[0],nullValue);
    assertEquals(row[1],nullValue);
    assertEquals(row[4],nullValue);
  }
  assertEquals(row[2],"String_Node_Str");
  assertEquals(row[3],"String_Node_Str");
}
Program: 163357
Project: 163357
Buggy source:
/** 
 * Writes an empty line to the output. <p> The newline character sequence will conform to what is specified in   {@link Format#getLineSeparator()}<p> The output will remain open for further writing.
 */
public final void writeEmptyRow(){
  try {
    writer.write(lineSeparator);
  }
 catch (  Throwable ex) {
    throw throwExceptionAndClose("String_Node_Str",Arrays.toString(lineSeparator),ex);
  }
}

Fixed version (ground truth):
/** 
 * Writes an empty line to the output, unless this is a   {@link com.univocity.parsers.fixed.FixedWidthWriter} whose{@link FixedWidthWriterSettings#getWriteLineSeparatorAfterRecord()} evaluates to {@code false}. <p> The newline character sequence will conform to what is specified in   {@link Format#getLineSeparator()}<p> The output will remain open for further writing.
 */
public final void writeEmptyRow(){
  try {
    if (enableNewlineAfterRecord) {
      writer.write(lineSeparator);
    }
  }
 catch (  Throwable ex) {
    throw throwExceptionAndClose("String_Node_Str",Arrays.toString(lineSeparator),ex);
  }
}
Program: 163358
Project: 163358
Buggy source:
/** 
 * Writes a comment row to the output. <p> A newline will automatically written after the given contents. The newline character sequence will conform to what is specified in   {@link Format#getLineSeparator()}<p> The output will remain open for further writing.
 * @param comment the contents to be written as a comment to the output
 */
public final void commentRow(String comment){
  writeRow(this.comment + comment);
}

Fixed version (ground truth):
/** 
 * Writes a comment row to the output. <p> A newline will automatically written after the given contents, unless this is a  {@link com.univocity.parsers.fixed.FixedWidthWriter} whose{@link FixedWidthWriterSettings#getWriteLineSeparatorAfterRecord()} evaluates to {@code false}. The newline character sequence will conform to what is specified in   {@link Format#getLineSeparator()}<p> The output will remain open for further writing.
 * @param comment the contents to be written as a comment to the output
 */
public final void commentRow(String comment){
  writeRow(this.comment + comment);
}
Program: 163359
Project: 163359
Buggy source:
/** 
 * Initializes the Fixed-Width writer with CSV-specific configuration
 * @param settings the Fixed-Width  writer configuration
 */
protected final void initialize(FixedWidthWriterSettings settings){
  FixedWidthFormat format=settings.getFormat();
  this.padding=format.getPadding();
  this.defaultPadding=padding;
  this.ignoreLeading=settings.getIgnoreLeadingWhitespaces();
  this.ignoreTrailing=settings.getIgnoreTrailingWhitespaces();
  this.fieldLengths=settings.getFieldLengths();
  this.fieldAlignments=settings.getFieldAlignments();
  this.fieldPaddings=settings.getFieldPaddings();
  this.lookaheadFormats=settings.getLookaheadFormats();
  this.lookbehindFormats=settings.getLookbehindFormats();
  this.defaultHeaderPadding=settings.getUseDefaultPaddingForHeaders();
  this.defaultHeaderAlignment=settings.getDefaultAlignmentForHeaders();
  if (lookaheadFormats != null || lookbehindFormats != null) {
    lookupChars=new char[Lookup.calculateMaxLookupLength(lookaheadFormats,lookbehindFormats)];
    rootLengths=fieldLengths;
    rootAlignments=fieldAlignments;
    rootPaddings=fieldPaddings;
  }
 else {
    lookupChars=null;
    rootLengths=null;
    rootAlignments=null;
    rootPaddings=null;
  }
}

Fixed version (ground truth):
/** 
 * Initializes the Fixed-Width writer with CSV-specific configuration
 * @param settings the Fixed-Width  writer configuration
 */
protected final void initialize(FixedWidthWriterSettings settings){
  FixedWidthFormat format=settings.getFormat();
  this.padding=format.getPadding();
  this.defaultPadding=padding;
  this.ignoreLeading=settings.getIgnoreLeadingWhitespaces();
  this.ignoreTrailing=settings.getIgnoreTrailingWhitespaces();
  this.fieldLengths=settings.getFieldLengths();
  this.fieldAlignments=settings.getFieldAlignments();
  this.fieldPaddings=settings.getFieldPaddings();
  this.lookaheadFormats=settings.getLookaheadFormats();
  this.lookbehindFormats=settings.getLookbehindFormats();
  this.defaultHeaderPadding=settings.getUseDefaultPaddingForHeaders();
  this.defaultHeaderAlignment=settings.getDefaultAlignmentForHeaders();
  super.enableNewlineAfterRecord(settings.getWriteLineSeparatorAfterRecord());
  if (lookaheadFormats != null || lookbehindFormats != null) {
    lookupChars=new char[Lookup.calculateMaxLookupLength(lookaheadFormats,lookbehindFormats)];
    rootLengths=fieldLengths;
    rootAlignments=fieldAlignments;
    rootPaddings=fieldPaddings;
  }
 else {
    lookupChars=null;
    rootLengths=null;
    rootAlignments=null;
    rootPaddings=null;
  }
}
Program: 163360
Project: 163360
Buggy source:
@Override protected void addConfiguration(Map<String,Object> out){
  super.addConfiguration(out);
  out.put("String_Node_Str",fieldLengths);
  out.put("String_Node_Str",lookaheadFormats);
  out.put("String_Node_Str",lookbehindFormats);
  out.put("String_Node_Str",useDefaultPaddingForHeaders);
  out.put("String_Node_Str",defaultAlignmentForHeaders);
}

Fixed version (ground truth):
@Override protected void addConfiguration(Map<String,Object> out){
  super.addConfiguration(out);
  out.put("String_Node_Str",writeLineSeparatorAfterRecord);
  out.put("String_Node_Str",fieldLengths);
  out.put("String_Node_Str",lookaheadFormats);
  out.put("String_Node_Str",lookbehindFormats);
  out.put("String_Node_Str",useDefaultPaddingForHeaders);
  out.put("String_Node_Str",defaultAlignmentForHeaders);
}
Program: 163361
Project: 163361
Buggy source:
private void appendAndExpand(char ch){
  try {
    chars[index++]=ch;
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    expand();
    chars[index]=ch;
  }
}

Fixed version (ground truth):
private void appendAndExpand(char ch){
  try {
    chars[index++]=ch;
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    expandAndRetry();
    appendAndExpand(ch);
  }
}
Program: 163362
Project: 163362
Buggy source:
private String[] handleEOF(){
  String[] row=null;
  if (output.column != 0) {
    if (output.appender.length() > 0) {
      output.valueParsed();
    }
 else {
      output.emptyParsed();
    }
    row=output.rowParsed();
  }
 else   if (output.appender.length() > 0) {
    output.valueParsed();
    row=output.rowParsed();
  }
  if (row != null) {
    rowProcessed(row);
  }
  return row;
}

Fixed version (ground truth):
private String[] handleEOF(){
  String[] row=null;
  try {
    if (output.column != 0) {
      if (output.appender.length() > 0) {
        output.valueParsed();
      }
 else {
        output.emptyParsed();
      }
      row=output.rowParsed();
    }
 else     if (output.appender.length() > 0) {
      output.valueParsed();
      row=output.rowParsed();
    }
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    throw handleException(e);
  }
  if (row != null) {
    rowProcessed(row);
  }
  return row;
}
Program: 163363
Project: 163363
Buggy source:
/** 
 * Initializes the ParserOutput with the configuration specified in   {@link CommonParserSettings}
 * @param settings the parser configuration
 */
public ParserOutput(CommonParserSettings<?> settings){
  this.appender=settings.newCharAppender();
  this.parsedValues=new String[settings.getMaxColumns()];
  this.appenders=new CharAppender[settings.getMaxColumns()];
  Arrays.fill(appenders,appender);
  this.settings=settings;
  this.skipEmptyLines=settings.getSkipEmptyLines();
  this.nullValue=settings.getNullValue();
  this.columnsToExtractInitialized=false;
  this.currentRecord=0;
}

Fixed version (ground truth):
/** 
 * Initializes the ParserOutput with the configuration specified in   {@link CommonParserSettings}
 * @param settings the parser configuration
 */
public ParserOutput(CommonParserSettings<?> settings){
  this.appender=settings.newCharAppender();
  this.parsedValues=new String[settings.getMaxColumns()];
  this.appenders=new CharAppender[settings.getMaxColumns() + 1];
  Arrays.fill(appenders,appender);
  this.settings=settings;
  this.skipEmptyLines=settings.getSkipEmptyLines();
  this.nullValue=settings.getNullValue();
  this.columnsToExtractInitialized=false;
  this.currentRecord=0;
}
Program: 163364
Project: 163364
Buggy source:
private void readValue(){
  if (ignoreTrailingWhitespace) {
    if (alignment == FieldAlignment.RIGHT) {
      while (length-- > 0) {
        output.appender.appendIgnoringWhitespace(ch);
        ch=input.nextChar();
      }
    }
 else {
      while (length-- > 0) {
        output.appender.appendIgnoringWhitespaceAndPadding(ch,padding);
        ch=input.nextChar();
      }
    }
  }
 else {
    if (alignment == FieldAlignment.RIGHT) {
      while (length-- > 0) {
        output.appender.append(ch);
        ch=input.nextChar();
      }
    }
 else {
      while (length-- > 0) {
        output.appender.appendIgnoringPadding(ch,padding);
        ch=input.nextChar();
      }
    }
  }
}

Fixed version (ground truth):
private void readValue(){
  length--;
  if (ignoreTrailingWhitespace) {
    if (alignment == FieldAlignment.RIGHT) {
      output.appender.appendIgnoringWhitespace(ch);
      while (length-- > 0) {
        output.appender.appendIgnoringWhitespace(ch=input.nextChar());
      }
    }
 else {
      output.appender.appendIgnoringWhitespaceAndPadding(ch,padding);
      while (length-- > 0) {
        output.appender.appendIgnoringWhitespaceAndPadding(ch=input.nextChar(),padding);
      }
    }
  }
 else {
    if (alignment == FieldAlignment.RIGHT) {
      output.appender.append(ch);
      while (length-- > 0) {
        output.appender.append(ch=input.nextChar());
      }
    }
 else {
      output.appender.appendIgnoringPadding(ch,padding);
      while (length-- > 0) {
        output.appender.appendIgnoringPadding(ch=input.nextChar(),padding);
      }
    }
  }
}
Program: 163366
Project: 163366
Buggy source:
/** 
 * Initializes the sequence of selected fields, if any.
 * @param values a sequence of values that represent the headers of the input. This can be either a parsed record or the headers as defined in {@link CommonSettings#getHeaders()}
 */
private void initializeColumnsToExtract(String[] values){
  FieldSelector selector=settings.getFieldSelector();
  if (selector != null) {
    selectedIndexes=selector.getFieldIndexes(values);
    if (selectedIndexes != null) {
      Arrays.fill(appenders,NoopCharAppender.getInstance());
      for (int i=0; i < selectedIndexes.length; i++) {
        appenders[selectedIndexes[i]]=appender;
      }
      columnsReordered=settings.isColumnReorderingEnabled();
      if (!columnsReordered && values.length < appenders.length) {
        Arrays.fill(appenders,values.length,appenders.length,appender);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Initializes the sequence of selected fields, if any.
 * @param values a sequence of values that represent the headers of the input. This can be either a parsed record or the headers as defined in {@link CommonSettings#getHeaders()}
 */
private void initializeColumnsToExtract(String[] values){
  FieldSelector selector=settings.getFieldSelector();
  if (selector != null) {
    selectedIndexes=selector.getFieldIndexes(values);
    if (selectedIndexes != null) {
      Arrays.fill(appenders,NoopCharAppender.getInstance());
      for (int i=0; i < selectedIndexes.length; i++) {
        int index=selectedIndexes[i];
        if (index != -1) {
          appenders[index]=appender;
        }
      }
      columnsReordered=settings.isColumnReorderingEnabled();
      if (!columnsReordered && values.length < appenders.length) {
        Arrays.fill(appenders,values.length,appenders.length,appender);
      }
    }
  }
}
Program: 163367
Project: 163367
Buggy source:
/** 
 * Gets all values parsed in the   {@link ParserOutput#parsedValues} array
 * @return the sequence of parsed values in a record.
 */
public String[] rowParsed(){
  if (column > 0) {
    if (!columnsToExtractInitialized) {
      initializeHeaders();
      if (settings.isHeaderExtractionEnabled()) {
        Arrays.fill(parsedValues,null);
        column=0;
        this.appender=appenders[0];
        return null;
      }
    }
    currentRecord++;
    if (columnsReordered) {
      String[] reorderedValues=new String[selectedIndexes.length];
      for (int i=0; i < selectedIndexes.length; i++) {
        int index=selectedIndexes[i];
        if (index >= column) {
          reorderedValues[i]=nullValue;
        }
 else {
          reorderedValues[i]=parsedValues[index];
        }
      }
      column=0;
      this.appender=appenders[0];
      return reorderedValues;
    }
 else {
      String[] out=new String[column];
      System.arraycopy(parsedValues,0,out,0,column);
      column=0;
      this.appender=appenders[0];
      return out;
    }
  }
 else   if (!skipEmptyLines) {
    if (!columnsToExtractInitialized) {
      initializeHeaders();
    }
    currentRecord++;
    if (columnsReordered) {
      String[] out=new String[selectedIndexes.length];
      Arrays.fill(out,nullValue);
      return out;
    }
    return ArgumentUtils.EMPTY_STRING_ARRAY;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Gets all values parsed in the   {@link ParserOutput#parsedValues} array
 * @return the sequence of parsed values in a record.
 */
public String[] rowParsed(){
  if (column > 0) {
    if (!columnsToExtractInitialized) {
      initializeHeaders();
      if (settings.isHeaderExtractionEnabled()) {
        Arrays.fill(parsedValues,null);
        column=0;
        this.appender=appenders[0];
        return null;
      }
    }
    currentRecord++;
    if (columnsReordered) {
      String[] reorderedValues=new String[selectedIndexes.length];
      for (int i=0; i < selectedIndexes.length; i++) {
        int index=selectedIndexes[i];
        if (index >= column || index == -1) {
          reorderedValues[i]=nullValue;
        }
 else {
          reorderedValues[i]=parsedValues[index];
        }
      }
      column=0;
      this.appender=appenders[0];
      return reorderedValues;
    }
 else {
      String[] out=new String[column];
      System.arraycopy(parsedValues,0,out,0,column);
      column=0;
      this.appender=appenders[0];
      return out;
    }
  }
 else   if (!skipEmptyLines) {
    if (!columnsToExtractInitialized) {
      initializeHeaders();
    }
    currentRecord++;
    if (columnsReordered) {
      String[] out=new String[selectedIndexes.length];
      Arrays.fill(out,nullValue);
      return out;
    }
    return ArgumentUtils.EMPTY_STRING_ARRAY;
  }
  return null;
}
Program: 163368
Project: 163368
Buggy source:
@Override public int[] getFieldIndexes(String[] headers){
  if (headers == null) {
    return null;
  }
  headers=ArgumentUtils.normalize(headers);
  List<String> selection=this.get();
  ArgumentUtils.normalize(selection);
  String[] chosenFields=selection.toArray(new String[selection.size()]);
  Object[] unknownFields=ArgumentUtils.findMissingElements(headers,chosenFields);
  if (unknownFields.length > 0 && !selection.containsAll(Arrays.asList(headers))) {
    if (unknownFields.length == chosenFields.length) {
      return new int[0];
    }
  }
  int[] out=new int[chosenFields.length];
  int i=0;
  Set<Integer> indexesTaken=new HashSet<Integer>();
  for (  String chosenField : chosenFields) {
    int index=ArgumentUtils.indexOf(headers,chosenField);
    if (index != -1) {
      indexesTaken.add(index);
    }
    out[i++]=index;
  }
  int generatedIndex=0;
  for (i=0; i < out.length; i++) {
    if (out[i] == -1) {
      while (indexesTaken.contains(generatedIndex)) {
        generatedIndex++;
      }
      indexesTaken.add(generatedIndex);
      out[i]=generatedIndex;
    }
  }
  return out;
}

Fixed version (ground truth):
@Override public int[] getFieldIndexes(String[] headers){
  if (headers == null) {
    return null;
  }
  headers=ArgumentUtils.normalize(headers);
  List<String> selection=this.get();
  ArgumentUtils.normalize(selection);
  String[] chosenFields=selection.toArray(new String[selection.size()]);
  Object[] unknownFields=ArgumentUtils.findMissingElements(headers,chosenFields);
  if (unknownFields.length > 0 && !selection.containsAll(Arrays.asList(headers))) {
    if (unknownFields.length == chosenFields.length) {
      return new int[0];
    }
  }
  int[] out=new int[chosenFields.length];
  int i=0;
  for (  String chosenField : chosenFields) {
    out[i++]=ArgumentUtils.indexOf(headers,chosenField);
  }
  return out;
}