Program: 59812
Project: 59812
Buggy source:
/** 
 * Gets a JavaScript line to be written to the data file that represents the current Measurement. All attributes required by the attributes list of this chart must be present in the measurement for the line to be returned.
 * @param measurement The current measurement.
 * @return The line representing the data in measurement specified by the attributes list of this chart, or null when there was some ofthe attributes missing.
 */
private String getResultLine(final Measurement measurement){
  final StringBuilder sb=new StringBuilder();
  boolean missingAttributes=false;
  sb.append(chart.getBaseName());
  sb.append("String_Node_Str");
switch (chart.getxAxisType()) {
case TIME:
    sb.append(measurement.getTime());
  break;
case ITERATION:
sb.append(measurement.getIteration());
break;
case PERCENTAGE:
sb.append(measurement.getPercentage());
break;
}
boolean isWarmUp=measurement.get(PerfCakeConst.WARM_UP_TAG) != null ? (Boolean)measurement.get(PerfCakeConst.WARM_UP_TAG) : false;
for (final String attr : chart.getAttributes()) {
if (chart.getAttributes().indexOf(attr) > 0) {
boolean warmUpAttr=attr.endsWith(PerfCakeConst.WARM_UP_TAG);
String pureAttr=warmUpAttr ? attr.substring(0,attr.length() - PerfCakeConst.WARM_UP_TAG.length() - 1) : attr;
sb.append("String_Node_Str");
if (!warmUpAttr && !measurement.getAll().containsKey(attr)) {
missingAttributes=true;
if (firstResultsLine) {
log.warn(String.format("String_Node_Str",attr));
}
}
 else {
final Object data=measurement.get(pureAttr);
if (isWarmUp ^ warmUpAttr) {
sb.append("String_Node_Str");
}
 else {
if (data instanceof String) {
sb.append("String_Node_Str");
sb.append(((String)data).replaceAll("String_Node_Str","String_Node_Str"));
sb.append("String_Node_Str");
}
 else if (data instanceof Quantity) {
sb.append(((Quantity)data).getNumber().toString());
}
 else {
sb.append(data == null ? "String_Node_Str" : data.toString());
}
}
}
}
}
firstResultsLine=false;
if (missingAttributes) {
return "String_Node_Str";
}
sb.append("String_Node_Str");
return sb.toString();
}

Fixed version (ground truth):
/** 
 * Gets a JavaScript line to be written to the data file that represents the current Measurement. All attributes required by the attributes list of this chart must be present in the measurement for the line to be returned.
 * @param measurement The current measurement.
 * @return The line representing the data in measurement specified by the attributes list of this chart, or null when there was some ofthe attributes missing.
 */
private String getResultLine(final Measurement measurement){
  final StringBuilder sb=new StringBuilder();
  boolean missingAttributes=false;
  boolean isWarmUp=measurement.get(PerfCakeConst.WARM_UP_TAG) != null ? (Boolean)measurement.get(PerfCakeConst.WARM_UP_TAG) : false;
  sb.append(chart.getBaseName());
  sb.append("String_Node_Str");
switch (chart.getxAxisType()) {
case TIME:
    sb.append(measurement.getTime());
  break;
case ITERATION:
sb.append(measurement.getIteration());
break;
case PERCENTAGE:
sb.append(measurement.getPercentage());
break;
}
int nullFields=0;
for (final String attr : chart.getAttributes()) {
if (chart.getAttributes().indexOf(attr) > 0) {
boolean warmUpAttr=attr.endsWith(PerfCakeConst.WARM_UP_TAG);
String pureAttr=warmUpAttr ? attr.substring(0,attr.length() - PerfCakeConst.WARM_UP_TAG.length() - 1) : attr;
sb.append("String_Node_Str");
if (!warmUpAttr && !measurement.getAll().containsKey(attr)) {
missingAttributes=true;
if (firstResultsLine) {
log.warn(String.format("String_Node_Str",attr));
}
}
 else {
final Object data=measurement.get(pureAttr);
if (isWarmUp ^ warmUpAttr) {
nullFields++;
sb.append("String_Node_Str");
}
 else {
if (data instanceof String) {
sb.append("String_Node_Str");
sb.append(((String)data).replaceAll("String_Node_Str","String_Node_Str"));
sb.append("String_Node_Str");
}
 else if (data instanceof Quantity) {
sb.append(((Quantity)data).getNumber().toString());
}
 else {
if (data == null) {
  nullFields++;
  sb.append("String_Node_Str");
}
 else {
  sb.append(data.toString());
}
}
}
}
}
}
firstResultsLine=false;
if (missingAttributes || chart.getAttributes().size() - nullFields <= 1) {
return "String_Node_Str";
}
sb.append("String_Node_Str");
return sb.toString();
}