Program: 30529
Project: 30529
Buggy source:
@Test public void testWriteMetricsFile() throws Exception {
  MetricsFile<TestMetric,Integer> file=new MetricsFile<TestMetric,Integer>();
  TestMetric metric=new TestMetric();
  metric.STRING_PROP="String_Node_Str";
  metric.DATE_PROP=new FormatUtil().parseDate("String_Node_Str");
  metric.SHORT_PROP=123;
  metric.INTEGER_PROP=null;
  metric.LONG_PROP=Long.MAX_VALUE;
  metric.FLOAT_PROP=456.789f;
  metric.DOUBLE_PROP=0.713487;
  metric.ENUM_PROP=TestEnum.Two;
  metric.BOOLEAN_PROP=false;
  metric.CHARACTER_PROP='A';
  metric.SHORT_PRIMITIVE=123;
  metric.INT_PRIMITIVE=919834781;
  metric.LONG_PRIMITIVE=Long.MAX_VALUE - Integer.MAX_VALUE;
  metric.FLOAT_PRIMITIVE=0.55694f;
  metric.DOUBLE_PRIMITIVE=0.229233;
  metric.BOOLEAN_PRIMITIVE=true;
  metric.CHAR_PRIMITIVE='B';
  file.addMetric(metric);
  MetricsFile<TestMetric,Integer> file2=writeThenReadBack(file);
  Assert.assertEquals(file,file2);
  StringHeader stringHeader=new StringHeader();
  stringHeader.setValue("String_Node_Str");
  file.addHeader(stringHeader);
  VersionHeader version=new VersionHeader();
  version.setVersionedItem("String_Node_Str");
  version.setVersionString("String_Node_Str");
  file.addHeader(version);
  version=new VersionHeader();
  version.setVersionedItem("String_Node_Str");
  version.setVersionString("String_Node_Str");
  file.addHeader(version);
  file2=writeThenReadBack(file);
  Assert.assertEquals(file,file2);
  Histogram<Integer> histo=new Histogram<Integer>();
  histo.setBinLabel("String_Node_Str");
  histo.setValueLabel("String_Node_Str");
  histo.increment(1,101);
  histo.increment(2,202);
  histo.increment(3,4000);
  histo.increment(5,123981);
  histo.increment(1000,10981982);
  file.setHistogram(histo);
  file2=writeThenReadBack(file);
  Assert.assertEquals(file,file2);
  TestMetric metric2=metric.clone();
  metric2.ENUM_PROP=TestEnum.One;
  metric2.FLOAT_PROP=0.998f;
  metric2.STRING_PROP="String_Node_Str";
  file.addMetric(metric2);
  metric2=metric.clone();
  metric2.ENUM_PROP=TestEnum.Three;
  metric2.DOUBLE_PRIMITIVE=1.299d;
  file.addMetric(metric2);
  file2=writeThenReadBack(file);
  Assert.assertEquals(file,file2);
  MetricsFile<TestMetric,Integer> file3=TestUtil.serializeAndDeserialize(file);
  Assert.assertEquals(file,file3);
}

Fixed version (ground truth):
@Test public void testWriteMetricsFile() throws IOException, ClassNotFoundException {
  MetricsFile<TestMetric,Integer> file=new MetricsFile<TestMetric,Integer>();
  TestMetric metric=new TestMetric();
  metric.STRING_PROP="String_Node_Str";
  metric.DATE_PROP=new FormatUtil().parseDate("String_Node_Str");
  metric.SHORT_PROP=123;
  metric.INTEGER_PROP=null;
  metric.LONG_PROP=Long.MAX_VALUE;
  metric.FLOAT_PROP=456.789f;
  metric.DOUBLE_PROP=0.713487;
  metric.ENUM_PROP=TestEnum.Two;
  metric.BOOLEAN_PROP=false;
  metric.CHARACTER_PROP='A';
  metric.SHORT_PRIMITIVE=123;
  metric.INT_PRIMITIVE=919834781;
  metric.LONG_PRIMITIVE=Long.MAX_VALUE - Integer.MAX_VALUE;
  metric.FLOAT_PRIMITIVE=0.55694f;
  metric.DOUBLE_PRIMITIVE=0.229233;
  metric.BOOLEAN_PRIMITIVE=true;
  metric.CHAR_PRIMITIVE='B';
  file.addMetric(metric);
  MetricsFile<TestMetric,Integer> file2=writeThenReadBack(file);
  Assert.assertEquals(file,file2);
  StringHeader stringHeader=new StringHeader();
  stringHeader.setValue("String_Node_Str");
  file.addHeader(stringHeader);
  VersionHeader version=new VersionHeader();
  version.setVersionedItem("String_Node_Str");
  version.setVersionString("String_Node_Str");
  file.addHeader(version);
  version=new VersionHeader();
  version.setVersionedItem("String_Node_Str");
  version.setVersionString("String_Node_Str");
  file.addHeader(version);
  file2=writeThenReadBack(file);
  Assert.assertEquals(file,file2);
  Histogram<Integer> histo=new Histogram<Integer>();
  histo.setBinLabel("String_Node_Str");
  histo.setValueLabel("String_Node_Str");
  histo.increment(1,101);
  histo.increment(2,202);
  histo.increment(3,4000);
  histo.increment(5,123981);
  histo.increment(1000,10981982);
  file.setHistogram(histo);
  file2=writeThenReadBack(file);
  Assert.assertEquals(file,file2);
  TestMetric metric2=metric.clone();
  metric2.ENUM_PROP=TestEnum.One;
  metric2.FLOAT_PROP=0.998f;
  metric2.STRING_PROP="String_Node_Str";
  file.addMetric(metric2);
  metric2=metric.clone();
  metric2.ENUM_PROP=TestEnum.Three;
  metric2.DOUBLE_PRIMITIVE=1.299d;
  file.addMetric(metric2);
  file2=writeThenReadBack(file);
  Assert.assertEquals(file,file2);
  MetricsFile<TestMetric,Integer> file3=TestUtil.serializeAndDeserialize(file);
  Assert.assertEquals(file,file3);
}