Program: 31464
Project: 31464
Buggy source:
@SuppressWarnings("String_Node_Str") public FormatParser of(long address,int len){
  long lim=address + len;
  long p=address;
  boolean suspended=false;
  int line=0;
  int comma=0;
  int pipe=0;
  int tab=0;
  int _comma=0;
  int _pipe=0;
  int _tab=0;
  commas.clear();
  pipes.clear();
  tabs.clear();
  this.avgRecLen=0;
  this.stdDev=Double.POSITIVE_INFINITY;
  this.format=null;
  while (p < lim) {
    char b=(char)Unsafe.getUnsafe().getByte(p++);
    if (suspended && b != '"') {
      continue;
    }
switch (b) {
case ',':
      comma++;
    break;
case '|':
  pipe++;
break;
case '\t':
tab++;
break;
case '"':
suspended=!suspended;
break;
case '\n':
line++;
commas.add(comma - _comma);
pipes.add(pipe - _pipe);
tabs.add(tab - _tab);
_comma=comma;
_pipe=pipe;
_tab=tab;
break;
default :
break;
}
}
if (line == 0) {
return this;
}
this.avgRecLen=len / line;
heap.clear();
heap.add(TextFileFormat.CSV.ordinal(),comma);
heap.add(TextFileFormat.PIPE.ordinal(),pipe);
heap.add(TextFileFormat.TAB.ordinal(),tab);
this.format=TextFileFormat.values()[heap.peekBottom()];
IntList test;
switch (format) {
case CSV:
test=commas;
break;
case PIPE:
test=pipes;
break;
case TAB:
test=tabs;
break;
default :
throw new IllegalArgumentException("String_Node_Str" + format);
}
double temp;
int n=test.size();
if (n == 0) {
format=null;
return this;
}
temp=0;
for (int i=0; i < n; i++) {
temp+=test.getQuick(i);
}
double mean=temp / n;
temp=0;
for (int i=0; i < n; i++) {
int v=test.getQuick(i);
temp+=(mean - v) * (mean - v);
}
this.stdDev=Math.sqrt(temp / n);
return this;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public FormatParser of(long address,int len){
  long lim=address + len;
  long p=address;
  boolean suspended=false;
  int line=0;
  int comma=0;
  int pipe=0;
  int tab=0;
  int _comma=0;
  int _pipe=0;
  int _tab=0;
  commas.clear();
  pipes.clear();
  tabs.clear();
  this.avgRecLen=0;
  this.stdDev=Double.POSITIVE_INFINITY;
  this.format=null;
  while (p < lim) {
    char b=(char)Unsafe.getUnsafe().getByte(p++);
    if (suspended && b != '"') {
      continue;
    }
switch (b) {
case ',':
      comma++;
    break;
case '|':
  pipe++;
break;
case '\t':
tab++;
break;
case '"':
suspended=!suspended;
break;
case '\n':
line++;
commas.add(comma - _comma);
pipes.add(pipe - _pipe);
tabs.add(tab - _tab);
_comma=comma;
_pipe=pipe;
_tab=tab;
break;
default :
break;
}
}
if (comma > _comma || pipe > _pipe || tab > _tab) {
line++;
commas.add(comma - _comma);
pipes.add(pipe - _pipe);
tabs.add(tab - _tab);
}
if (line == 0) {
return this;
}
this.avgRecLen=len / line;
heap.clear();
heap.add(TextFileFormat.CSV.ordinal(),comma);
heap.add(TextFileFormat.PIPE.ordinal(),pipe);
heap.add(TextFileFormat.TAB.ordinal(),tab);
this.format=TextFileFormat.values()[heap.peekBottom()];
IntList test;
switch (format) {
case CSV:
test=commas;
break;
case PIPE:
test=pipes;
break;
case TAB:
test=tabs;
break;
default :
throw new IllegalArgumentException("String_Node_Str" + format);
}
double temp;
int n=test.size();
if (n == 0) {
format=null;
return this;
}
temp=0;
for (int i=0; i < n; i++) {
temp+=test.getQuick(i);
}
double mean=temp / n;
temp=0;
for (int i=0; i < n; i++) {
int v=test.getQuick(i);
temp+=(mean - v) * (mean - v);
}
this.stdDev=Math.sqrt(temp / n);
return this;
}