nus-yam/ex-repair huggingface dataset:
Program: 30526
Project: 30526
Buggy source:
public int hashCode(){
  int result=0;
  for (  final Field f : getClass().getFields()) {
    try {
      result=31 * result + f.get(this).hashCode();
    }
 catch (    IllegalAccessException e) {
      throw new SAMException("String_Node_Str" + f.getName() + "String_Node_Str"+ getClass().getSimpleName());
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Computes a hashcode by formatting each field into its on disk representation  and summing the hashcodes of all the fields.
 */
public int hashCode(){
  int result=0;
  FormatUtil formatter=new FormatUtil();
  for (  final Field f : getClass().getFields()) {
    try {
      Object value=f.get(this);
      value=formatter.format(value);
      final int fieldHash=value != null ? value.hashCode() : 0;
      result=31 * result + fieldHash;
    }
 catch (    IllegalAccessException e) {
      throw new SAMException("String_Node_Str" + f.getName() + "String_Node_Str"+ getClass().getSimpleName());
    }
  }
  return result;
}
Program: 30527
Project: 30527
Buggy source:
public boolean equals(MetricBase that){
  for (  Field field : this.getClass().getFields()) {
    try {
      if (!Objects.equals(field.get(this),field.get(that))) {
        return false;
      }
    }
 catch (    IllegalAccessException ex) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * An equals method that checks equality by asserting that the classes are of the exact same type and that all public fields are equivalent.  Equivalence is checked by formatting the field as it would be written to disk and then checking String equality.
 * @param o an instance to compare to
 * @return true if they are equal, false otherwise
 */
public boolean equals(final Object o){
  if (o == null)   return false;
  if (o.getClass() != getClass())   return false;
  final FormatUtil formatter=new FormatUtil();
  for (  final Field f : getClass().getFields()) {
    try {
      final Object lhs=f.get(this);
      final Object rhs=f.get(o);
      if (lhs == null) {
        if (rhs == null) {
        }
 else {
          return false;
        }
      }
 else {
        if (formatter.format(lhs).equals(formatter.format(rhs))) {
        }
 else {
          return false;
        }
      }
    }
 catch (    IllegalAccessException iae) {
      throw new SAMException("String_Node_Str" + f.getName() + "String_Node_Str"+ getClass().getSimpleName());
    }
  }
  return true;
}
Program: 30528
Project: 30528
Buggy source:
/** 
 * Constructs a new FormatUtil and initializes various internal formatters. 
 */
public FormatUtil(){
  this.dateFormat=new SimpleDateFormat("String_Node_Str");
  this.integerFormat=NumberFormat.getIntegerInstance();
  this.integerFormat.setGroupingUsed(false);
  this.floatFormat=NumberFormat.getNumberInstance();
  this.floatFormat.setGroupingUsed(false);
  this.floatFormat.setMaximumFractionDigits(6);
  this.floatFormat.setRoundingMode(RoundingMode.HALF_DOWN);
  if (this.floatFormat instanceof DecimalFormat) {
    final DecimalFormat decimalFormat=(DecimalFormat)this.floatFormat;
    final DecimalFormatSymbols decimalFormatSymbols=decimalFormat.getDecimalFormatSymbols();
    decimalFormatSymbols.setNaN("String_Node_Str");
    decimalFormatSymbols.setInfinity("String_Node_Str");
    decimalFormat.setDecimalFormatSymbols(decimalFormatSymbols);
  }
}

Fixed version (ground truth):
/** 
 * Constructs a new FormatUtil and initializes various internal formatters.  This is necessary because SimpleDateFormat and other formatters are not threadsafe.
 */
public FormatUtil(){
  this.dateFormat=new SimpleDateFormat("String_Node_Str");
  this.integerFormat=NumberFormat.getIntegerInstance();
  this.integerFormat.setGroupingUsed(false);
  this.floatFormat=NumberFormat.getNumberInstance();
  this.floatFormat.setGroupingUsed(false);
  this.floatFormat.setMaximumFractionDigits(DECIMAL_DIGITS_TO_PRINT);
  this.floatFormat.setRoundingMode(RoundingMode.HALF_DOWN);
  if (this.floatFormat instanceof DecimalFormat) {
    final DecimalFormat decimalFormat=(DecimalFormat)this.floatFormat;
    final DecimalFormatSymbols decimalFormatSymbols=decimalFormat.getDecimalFormatSymbols();
    decimalFormatSymbols.setNaN("String_Node_Str");
    decimalFormatSymbols.setInfinity("String_Node_Str");
    decimalFormat.setDecimalFormatSymbols(decimalFormatSymbols);
  }
}
Program: 30530
Project: 30530
Buggy source:
/** 
 * Helper method to persist metrics to file and read them back again. 
 */
private MetricsFile<TestMetric,Integer> writeThenReadBack(MetricsFile<TestMetric,Integer> in) throws Exception {
  File f=File.createTempFile("String_Node_Str","String_Node_Str");
  f.deleteOnExit();
  FileWriter out=new FileWriter(f);
  in.write(out);
  MetricsFile<TestMetric,Integer> retval=new MetricsFile<TestMetric,Integer>();
  retval.read(new FileReader(f));
  return retval;
}

Fixed version (ground truth):
/** 
 * Helper method to persist metrics to file and read them back again. 
 */
private <METRIC extends MetricBase>MetricsFile<METRIC,Integer> writeThenReadBack(MetricsFile<METRIC,Integer> in) throws IOException {
  File f=File.createTempFile("String_Node_Str","String_Node_Str");
  f.deleteOnExit();
  FileWriter out=new FileWriter(f);
  in.write(out);
  MetricsFile<METRIC,Integer> retval=new MetricsFile<METRIC,Integer>();
  retval.read(new FileReader(f));
  return retval;
}
Program: 30531
Project: 30531
Buggy source:
/** 
 * @param cigarette CIGAR element (operator + length) encoded as an unsigned int.
 * @return Object representation of the CIGAR element.
 */
private static CigarElement binaryCigarToCigarElement(final int cigarette){
  final int binaryOp=cigarette & 0xf;
  final int length=cigarette >> 4;
  return new CigarElement(length,CigarOperator.binaryToEnum(binaryOp));
}

Fixed version (ground truth):
/** 
 * @param cigarette CIGAR element (operator + length) encoded as an unsigned int.
 * @return Object representation of the CIGAR element.
 */
private static CigarElement binaryCigarToCigarElement(final int cigarette){
  final int binaryOp=cigarette & 0xf;
  final int length=cigarette >>> 4;
  return new CigarElement(length,CigarOperator.binaryToEnum(binaryOp));
}
Program: 30532
Project: 30532
Buggy source:
/** 
 * Generates a BAM index file from an input BAM file
 * @param reader SAMFileReader for input BAM file
 * @param output File for output index file
 */
public static void createIndex(SamReader reader,File output,Log log){
  BAMIndexer indexer=new BAMIndexer(output,reader.getFileHeader());
  int totalRecords=0;
  for (  SAMRecord rec : reader) {
    if (++totalRecords % 1000000 == 0) {
      if (null != log)       log.info(totalRecords + "String_Node_Str");
    }
    indexer.processAlignment(rec);
  }
  indexer.finish();
}

Fixed version (ground truth):
/** 
 * Generates a BAM index file from an input BAM file
 * @param reader SAMFileReader for input BAM file
 * @param output File for output index file
 */
public static void createIndex(SamReader reader,File output,Log log){
  BAMIndexer indexer=new BAMIndexer(output,reader.getFileHeader());
  long totalRecords=0;
  for (  SAMRecord rec : reader) {
    if (++totalRecords % 1000000 == 0) {
      if (null != log)       log.info(totalRecords + "String_Node_Str");
    }
    indexer.processAlignment(rec);
  }
  indexer.finish();
}
Program: 30533
Project: 30533
Buggy source:
/** 
 * Sets a header line in the header metadata. This is essentially a Set.add call, which means that equals() and hashCode() are used to determine whether an additional header line is added or an existing header line is replaced.
 */
public void addMetaDataLine(final VCFHeaderLine headerLine){
  addMetadataHeaderLine(headerLine);
}

Fixed version (ground truth):
/** 
 * Adds a new line to the VCFHeader. If there is an existing header line of the same type with the same key, the new line is not added and the existing line is preserved.
 * @param headerLine header line to attempt to add
 */
public void addMetaDataLine(final VCFHeaderLine headerLine){
  if (addMetadataLineLookupEntry(headerLine)) {
    mMetaData.add(headerLine);
    checkForDeprecatedGenotypeLikelihoodsKey();
  }
}
Program: 30534
Project: 30534
Buggy source:
/** 
 * Sets a header line in the header metadata. This is essentially a Set.add call, which means that equals() and hashCode() are used to determine whether an additional header line is added or an existing header line is replaced.
 */
public void addMetaDataLine(final VCFHeaderLine headerLine){
  addMetadataHeaderLine(headerLine);
}

Fixed version (ground truth):
/** 
 * Adds a new line to the VCFHeader. If there is an existing header line of the same type with the same key, the new line is not added and the existing line is preserved.
 * @param headerLine header line to attempt to add
 */
public void addMetaDataLine(final VCFHeaderLine headerLine){
  if (addMetadataLineLookupEntry(headerLine)) {
    mMetaData.add(headerLine);
    checkForDeprecatedGenotypeLikelihoodsKey();
  }
}
Program: 30535
Project: 30535
Buggy source:
/** 
 * @see {@link AsciiFeatureCodec#decode(htsjdk.tribble.readers.LineIterator)} 
 */
public abstract T decode(String s);

Fixed version (ground truth):
/** 
 * @see AsciiFeatureCodec#decode(htsjdk.tribble.readers.LineIterator) 
 */
public abstract T decode(String s);
Program: 30536
Project: 30536
Buggy source:
/** 
 * This function returns true iff the File potentialInput can be parsed by this codec. <p/> There is an assumption that there's never a situation where two different Codecs return true for the same file.  If this occurs, the recommendation would be to error out. <p/> Note this function must never throw an error.  All errors should be trapped and false returned.
 * @param path the file to test for parsability with this codec
 * @return true if potentialInput can be parsed, false otherwise
 */
public boolean canDecode(final String path);

Fixed version (ground truth):
/** 
 * <p> This function returns true iff the File potentialInput can be parsed by this codec. </p> <p> There is an assumption that there's never a situation where two different Codecs return true for the same file.  If this occurs, the recommendation would be to error out. </p> Note this function must never throw an error.  All errors should be trapped and false returned.
 * @param path the file to test for parsability with this codec
 * @return true if potentialInput can be parsed, false otherwise
 */
public boolean canDecode(final String path);
Program: 30537
Project: 30537
Buggy source:
/** 
 * This function returns the object the codec generates.  This is allowed to be Feature in the case where conditionally different types are generated.  Be as specific as you can though. <p/> This function is used by reflections based tools, so we can know the underlying type
 * @return the feature type this codec generates.
 */
public Class<FEATURE_TYPE> getFeatureType();

Fixed version (ground truth):
/** 
 * <p> This function returns the object the codec generates.  This is allowed to be Feature in the case where conditionally different types are generated.  Be as specific as you can though. </p> <p> This function is used by reflections based tools, so we can know the underlying type </p>
 * @return the feature type this codec generates.
 */
public Class<FEATURE_TYPE> getFeatureType();
Program: 30538
Project: 30538
Buggy source:
/** 
 * Reads the next record from input stream and prepare this decoder to decode values from it
 * @param stream
 * @return
 */
public void readNextBlock(final int blockSizeInBytes,final InputStream stream){
  if (blockSizeInBytes < 0)   throw new TribbleException("String_Node_Str" + blockSizeInBytes);
  setRecordBytes(readRecordBytes(blockSizeInBytes,stream));
}

Fixed version (ground truth):
/** 
 * Reads the next record from input stream and prepare this decoder to decode values from it
 * @param stream
 */
public void readNextBlock(final int blockSizeInBytes,final InputStream stream){
  if (blockSizeInBytes < 0)   throw new TribbleException("String_Node_Str" + blockSizeInBytes);
  setRecordBytes(readRecordBytes(blockSizeInBytes,stream));
}
Program: 30539
Project: 30539
Buggy source:
/** 
 * Skips the next record from input stream, invalidating current block data
 * @param stream
 * @return
 */
public void skipNextBlock(final int blockSizeInBytes,final InputStream stream){
  try {
    final int bytesRead=(int)stream.skip(blockSizeInBytes);
    validateReadBytes(bytesRead,1,blockSizeInBytes);
  }
 catch (  IOException e) {
    throw new TribbleException("String_Node_Str",e);
  }
  this.recordBytes=null;
  this.recordStream=null;
}

Fixed version (ground truth):
/** 
 * Skips the next record from input stream, invalidating current block data
 * @param stream
 */
public void skipNextBlock(final int blockSizeInBytes,final InputStream stream){
  try {
    final int bytesRead=(int)stream.skip(blockSizeInBytes);
    validateReadBytes(bytesRead,1,blockSizeInBytes);
  }
 catch (  IOException e) {
    throw new TribbleException("String_Node_Str",e);
  }
  this.recordBytes=null;
  this.recordStream=null;
}
Program: 30540
Project: 30540
Buggy source:
/** 
 * Collapse multiple strings into a comma separated list ["s1", "s2", "s3"] => ",s1,s2,s3"
 * @param strings size > 1 list of strings
 * @return
 */
public static String collapseStringList(final List<String> strings){
}

Fixed version (ground truth):
/** 
 * Collapse multiple strings into a comma separated list ["s1", "s2", "s3"] =&gt; ",s1,s2,s3"
 * @param strings size &gt; 1 list of strings
 * @return
 */
public static String collapseStringList(final List<String> strings){
}
Program: 30541
Project: 30541
Buggy source:
/** 
 * Returns a good name for a shadow BCF file for vcfFile. foo.vcf => foo.bcf foo.xxx => foo.xxx.bcf If the resulting BCF file cannot be written, return null.  Happens when vcfFile = /dev/null for example
 * @param vcfFile
 * @return the BCF
 */
public static final File shadowBCF(final File vcfFile){
  final String path=vcfFile.getAbsolutePath();
  if (path.contains("String_Node_Str"))   return new File(path.replace("String_Node_Str","String_Node_Str"));
 else {
    final File bcf=new File(path + "String_Node_Str");
    if (bcf.canRead())     return bcf;
 else {
      try {
        final FileOutputStream o=new FileOutputStream(bcf);
        o.close();
        bcf.delete();
        return bcf;
      }
 catch (      FileNotFoundException e) {
        return null;
      }
catch (      IOException e) {
        return null;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Returns a good name for a shadow BCF file for vcfFile. foo.vcf =&gt; foo.bcf foo.xxx =&gt; foo.xxx.bcf If the resulting BCF file cannot be written, return null.  Happens when vcfFile = /dev/null for example
 * @param vcfFile
 * @return the BCF
 */
public static final File shadowBCF(final File vcfFile){
  final String path=vcfFile.getAbsolutePath();
  if (path.contains("String_Node_Str"))   return new File(path.replace("String_Node_Str","String_Node_Str"));
 else {
    final File bcf=new File(path + "String_Node_Str");
    if (bcf.canRead())     return bcf;
 else {
      try {
        final FileOutputStream o=new FileOutputStream(bcf);
        o.close();
        bcf.delete();
        return bcf;
      }
 catch (      FileNotFoundException e) {
        return null;
      }
catch (      IOException e) {
        return null;
      }
    }
  }
}
Program: 30542
Project: 30542
Buggy source:
/** 
 * Helper function that takes an object and returns a list representation of it: o == null => [] o is a list => o else => [o]
 * @param c  the class of the object
 * @param o  the object to convert to a Java List
 * @return
 */
public static <T>List<T> toList(final Class<T> c,final Object o){
  if (o == null)   return Collections.emptyList();
 else   if (o instanceof List)   return (List<T>)o;
 else   if (o.getClass().isArray()) {
    final int arraySize=Array.getLength(o);
    final List<T> list=new ArrayList<T>(arraySize);
    for (int i=0; i < arraySize; i++)     list.add((T)Array.get(o,i));
    return list;
  }
 else   return Collections.singletonList((T)o);
}

Fixed version (ground truth):
/** 
 * Helper function that takes an object and returns a list representation of it: o == null =&gt; [] o is a list =&gt; o else =&gt; [o]
 * @param c  the class of the object
 * @param o  the object to convert to a Java List
 * @return
 */
public static <T>List<T> toList(final Class<T> c,final Object o){
  if (o == null)   return Collections.emptyList();
 else   if (o instanceof List)   return (List<T>)o;
 else   if (o.getClass().isArray()) {
    final int arraySize=Array.getLength(o);
    final List<T> list=new ArrayList<T>(arraySize);
    for (int i=0; i < arraySize; i++)     list.add((T)Array.get(o,i));
    return list;
  }
 else   return Collections.singletonList((T)o);
}
Program: 30543
Project: 30543
Buggy source:
/** 
 * Inverse operation of collapseStringList. ",s1,s2,s3" => ["s1", "s2", "s3"]
 * @param collapsed
 * @return
 */
public static List<String> explodeStringList(final String collapsed){
}

Fixed version (ground truth):
/** 
 * Inverse operation of collapseStringList. ",s1,s2,s3" =&gt; ["s1", "s2", "s3"]
 * @param collapsed
 * @return
 */
public static List<String> explodeStringList(final String collapsed){
}
Program: 30544
Project: 30544
Buggy source:
/** 
 * Make all combinations of N size of objects if objects = [A, B, C] if N = 1 => [[A], [B], [C]] if N = 2 => [[A, A], [B, A], [C, A], [A, B], [B, B], [C, B], [A, C], [B, C], [C, C]]
 * @param objects
 * @param n
 * @param < T >
 * @param withReplacement if false, the resulting permutations will only contain unique objects from objects
 * @return
 */
public static <T>List<List<T>> makePermutations(final List<T> objects,final int n,final boolean withReplacement){
  final List<List<T>> combinations=new ArrayList<List<T>>();
  if (n <= 0)   ;
 else   if (n == 1) {
    for (    final T o : objects)     combinations.add(Collections.singletonList(o));
  }
 else {
    final List<List<T>> sub=makePermutations(objects,n - 1,withReplacement);
    for (    List<T> subI : sub) {
      for (      final T a : objects) {
        if (withReplacement || !subI.contains(a))         combinations.add(cons(a,subI));
      }
    }
  }
  return combinations;
}

Fixed version (ground truth):
/** 
 * Make all combinations of N size of objects if objects = [A, B, C] if N = 1 =&gt; [[A], [B], [C]] if N = 2 =&gt; [[A, A], [B, A], [C, A], [A, B], [B, B], [C, B], [A, C], [B, C], [C, C]]
 * @param objects
 * @param n
 * @param < T >
 * @param withReplacement if false, the resulting permutations will only contain unique objects from objects
 * @return
 */
public static <T>List<List<T>> makePermutations(final List<T> objects,final int n,final boolean withReplacement){
  final List<List<T>> combinations=new ArrayList<List<T>>();
  if (n <= 0)   ;
 else   if (n == 1) {
    for (    final T o : objects)     combinations.add(Collections.singletonList(o));
  }
 else {
    final List<List<T>> sub=makePermutations(objects,n - 1,withReplacement);
    for (    List<T> subI : sub) {
      for (      final T a : objects) {
        if (withReplacement || !subI.contains(a))         combinations.add(cons(a,subI));
      }
    }
  }
  return combinations;
}
Program: 30545
Project: 30545
Buggy source:
/** 
 * Return the printed representation of this allele. Same as getBaseString(), except for symbolic alleles. For symbolic alleles, the base string is empty while the display string contains <TAG>.
 * @return the allele string representation
 */
public String getDisplayString(){
  return new String(bases);
}

Fixed version (ground truth):
/** 
 * Return the printed representation of this allele. Same as getBaseString(), except for symbolic alleles. For symbolic alleles, the base string is empty while the display string contains &lt;TAG&gt;.
 * @return the allele string representation
 */
public String getDisplayString(){
  return new String(bases);
}
Program: 30547
Project: 30547
Buggy source:
/** 
 * Sadly, this is a duplicate of the method above, except that it takes char[] for referenceBases rather than byte[].  This is because GATK needs it this way. <p/> TODO: Remove this method when GATK map method is changed to take refseq as byte[].
 */
public static int calculateSamNmTag(final SAMRecord read,final char[] referenceBases,final int referenceOffset){
  int samNm=countMismatches(read,referenceBases,referenceOffset);
  for (  final CigarElement el : read.getCigar().getCigarElements()) {
    if (el.getOperator() == CigarOperator.INSERTION || el.getOperator() == CigarOperator.DELETION) {
      samNm+=el.getLength();
    }
  }
  return samNm;
}

Fixed version (ground truth):
/** 
 * Sadly, this is a duplicate of the method above, except that it takes char[] for referenceBases rather than byte[].  This is because GATK needs it this way. <p/> TODO: Remove this method when GATK map method is changed to take refseq as byte[]. TODO: UPDATE: Seems to be removed from GATK. Deprecated now to be removed in a future version.
 */
@Deprecated public static int calculateSamNmTag(final SAMRecord read,final char[] referenceBases,final int referenceOffset){
  int samNm=countMismatches(read,referenceBases,referenceOffset);
  for (  final CigarElement el : read.getCigar().getCigarElements()) {
    if (el.getOperator() == CigarOperator.INSERTION || el.getOperator() == CigarOperator.DELETION) {
      samNm+=el.getLength();
    }
  }
  return samNm;
}
Program: 30548
Project: 30548
Buggy source:
/** 
 * Sadly, this is a duplicate of the method above, except that it takes char[] for referenceBases rather than byte[].  This is because GATK needs it this way. <p/> TODO: Remove this method when GATK map method is changed to take refseq as byte[].
 */
private static int countMismatches(final SAMRecord read,final char[] referenceBases,final int referenceOffset){
  int mismatches=0;
  final byte[] readBases=read.getReadBases();
  for (  final AlignmentBlock block : read.getAlignmentBlocks()) {
    final int readBlockStart=block.getReadStart() - 1;
    final int referenceBlockStart=block.getReferenceStart() - 1 - referenceOffset;
    final int length=block.getLength();
    for (int i=0; i < length; ++i) {
      if (!basesEqual(readBases[readBlockStart + i],StringUtil.charToByte(referenceBases[referenceBlockStart + i]))) {
        ++mismatches;
      }
    }
  }
  return mismatches;
}

Fixed version (ground truth):
/** 
 * Sadly, this is a duplicate of the method above, except that it takes char[] for referenceBases rather than byte[].  This is because GATK needs it this way. <p/> TODO: Remove this method when GATK map method is changed to take refseq as byte[]. TODO: UPDATE: Seems to be removed from GATK. Deprecated now to be removed in a future version.
 */
@Deprecated private static int countMismatches(final SAMRecord read,final char[] referenceBases,final int referenceOffset){
  int mismatches=0;
  final byte[] readBases=read.getReadBases();
  for (  final AlignmentBlock block : read.getAlignmentBlocks()) {
    final int readBlockStart=block.getReadStart() - 1;
    final int referenceBlockStart=block.getReferenceStart() - 1 - referenceOffset;
    final int length=block.getLength();
    for (int i=0; i < length; ++i) {
      if (!basesEqual(readBases[readBlockStart + i],StringUtil.charToByte(referenceBases[referenceBlockStart + i]))) {
        ++mismatches;
      }
    }
  }
  return mismatches;
}
Program: 30549
Project: 30549
Buggy source:
/** 
 * Sadly, this is a duplicate of the method above, except that it takes char[] for referenceBases rather than byte[].  This is because GATK needs it this way. <p/> TODO: Remove this method when GATK map method is changed to take refseq as byte[].
 */
public static int sumQualitiesOfMismatches(final SAMRecord read,final char[] referenceBases,final int referenceOffset){
  int qualities=0;
  final byte[] readBases=read.getReadBases();
  final byte[] readQualities=read.getBaseQualities();
  if (read.getAlignmentStart() <= referenceOffset) {
    throw new IllegalArgumentException("String_Node_Str" + read.getAlignmentStart() + "String_Node_Str"+ referenceOffset+ "String_Node_Str");
  }
  for (  final AlignmentBlock block : read.getAlignmentBlocks()) {
    final int readBlockStart=block.getReadStart() - 1;
    final int referenceBlockStart=block.getReferenceStart() - 1 - referenceOffset;
    final int length=block.getLength();
    for (int i=0; i < length; ++i) {
      if (!basesEqual(readBases[readBlockStart + i],StringUtil.charToByte(referenceBases[referenceBlockStart + i]))) {
        qualities+=readQualities[readBlockStart + i];
      }
    }
  }
  return qualities;
}

Fixed version (ground truth):
/** 
 * Sadly, this is a duplicate of the method above, except that it takes char[] for referenceBases rather than byte[].  This is because GATK needs it this way. <p/> TODO: Remove this method when GATK map method is changed to take refseq as byte[]. TODO: UPDATE: Seems to be removed from GATK. Deprecated now to be removed in a future version.
 */
@Deprecated public static int sumQualitiesOfMismatches(final SAMRecord read,final char[] referenceBases,final int referenceOffset){
  int qualities=0;
  final byte[] readBases=read.getReadBases();
  final byte[] readQualities=read.getBaseQualities();
  if (read.getAlignmentStart() <= referenceOffset) {
    throw new IllegalArgumentException("String_Node_Str" + read.getAlignmentStart() + "String_Node_Str"+ referenceOffset+ "String_Node_Str");
  }
  for (  final AlignmentBlock block : read.getAlignmentBlocks()) {
    final int readBlockStart=block.getReadStart() - 1;
    final int referenceBlockStart=block.getReferenceStart() - 1 - referenceOffset;
    final int length=block.getLength();
    for (int i=0; i < length; ++i) {
      if (!basesEqual(readBases[readBlockStart + i],StringUtil.charToByte(referenceBases[referenceBlockStart + i]))) {
        qualities+=readQualities[readBlockStart + i];
      }
    }
  }
  return qualities;
}
Program: 30550
Project: 30550
Buggy source:
/** 
 * Takes all of the builder data provided up to this point, and instantiates a freshly allocated VariantContext with all of the builder data.  This VariantContext is validated as appropriate and if not failing QC (and throwing an exception) is returned. Note that this function can be called multiple times to create multiple VariantContexts from the same builder.
 */
public VariantContext make(){
  return new VariantContext(source,ID,contig,start,stop,alleles,genotypes,log10PError,filters,attributes,fullyDecoded,toValidate);
}

Fixed version (ground truth):
public VariantContext make(final boolean leaveModifyableAsIs){
  if (!leaveModifyableAsIs)   attributesCanBeModified=false;
  return new VariantContext(source,ID,contig,start,stop,alleles,genotypes,log10PError,filters,attributes,fullyDecoded,toValidate);
}
Program: 30551
Project: 30551
Buggy source:
/** 
 * Return a VCF-like string representation for the alleles of this genotype. If ignoreRefState is true, will not append the reference * marker on the alleles.
 * @return a string representing the genotypes, or null if the type is unavailable.
 */
public String getGenotypeString(boolean ignoreRefState){
  if (getPloidy() == 0)   return "String_Node_Str";
  return ParsingUtils.join(isPhased() ? PHASED_ALLELE_SEPARATOR : UNPHASED_ALLELE_SEPARATOR,ignoreRefState ? (Collection)getAlleleStrings() : (isPhased() ? getAlleles() : ParsingUtils.sortList(getAlleles())));
}

Fixed version (ground truth):
/** 
 * Return a VCF-like string representation for the alleles of this genotype. If ignoreRefState is true, will not append the reference * marker on the alleles.
 * @return a string representing the genotypes, or null if the type is unavailable.
 */
public String getGenotypeString(boolean ignoreRefState){
  if (getPloidy() == 0)   return "String_Node_Str";
  final String separator=isPhased() ? PHASED_ALLELE_SEPARATOR : UNPHASED_ALLELE_SEPARATOR;
  if (ignoreRefState) {
    return ParsingUtils.join(separator,getAlleleStrings());
  }
  List<Allele> alleles=isPhased() ? getAlleles() : ParsingUtils.sortList(getAlleles());
  return ParsingUtils.join(separator,alleles);
}
Program: 30552
Project: 30552
Buggy source:
/** 
 * Allows construction of a VCFFileReader with a specified index file. 
 */
public VCFFileReader(final File file,final File indexFile,final boolean requireIndex){
  this.reader=AbstractFeatureReader.getFeatureReader(file.getAbsolutePath(),indexFile.getAbsolutePath(),isBCF(file) ? (FeatureCodec)new BCF2Codec() : new VCFCodec(),requireIndex);
}

Fixed version (ground truth):
/** 
 * Allows construction of a VCFFileReader with a specified index file. 
 */
public VCFFileReader(final File file,final File indexFile,final boolean requireIndex){
  FeatureCodec<VariantContext,?> codec=isBCF(file) ? new BCF2Codec() : new VCFCodec();
  this.reader=AbstractFeatureReader.getFeatureReader(file.getAbsolutePath(),indexFile.getAbsolutePath(),codec,requireIndex);
}
Program: 30553
Project: 30553
Buggy source:
public SAMSequenceRecord getSAMSequenceRecord(){
  final String lengthString=this.getGenericFieldValue("String_Node_Str");
  if (lengthString == null)   throw new TribbleException("String_Node_Str" + this.getID() + "String_Node_Str");
  final SAMSequenceRecord record=new SAMSequenceRecord(this.getID(),Integer.valueOf(lengthString));
  record.setSequenceIndex(this.contigIndex);
  return record;
}

Fixed version (ground truth):
public SAMSequenceRecord getSAMSequenceRecord(){
  final String lengthString=this.getGenericFieldValue("String_Node_Str");
  if (lengthString == null)   throw new TribbleException("String_Node_Str" + this.getID() + "String_Node_Str");
  final SAMSequenceRecord record=new SAMSequenceRecord(this.getID(),Integer.valueOf(lengthString));
  record.setAssembly(this.getGenericFieldValue("String_Node_Str"));
  record.setSequenceIndex(this.contigIndex);
  return record;
}
Program: 30554
Project: 30554
Buggy source:
VCFContigHeaderLine(final SAMSequenceRecord sequenceRecord,final String assembly){
  super(VCFHeader.CONTIG_KEY,new HashMap<String,String>(){
{
      this.put("String_Node_Str",sequenceRecord.getSequenceName());
      this.put("String_Node_Str",Integer.toString(sequenceRecord.getSequenceLength()));
      if (assembly != null)       this.put("String_Node_Str",assembly);
    }
  }
);
  this.contigIndex=sequenceRecord.getSequenceIndex();
}

Fixed version (ground truth):
VCFContigHeaderLine(final SAMSequenceRecord sequenceRecord,final String assembly){
  super(VCFHeader.CONTIG_KEY,new LinkedHashMap<String,String>(){
{
      this.put("String_Node_Str",sequenceRecord.getSequenceName());
      this.put("String_Node_Str",Integer.toString(sequenceRecord.getSequenceLength()));
      if (assembly != null)       this.put("String_Node_Str",assembly);
    }
  }
);
  this.contigIndex=sequenceRecord.getSequenceIndex();
}
Program: 30555
Project: 30555
Buggy source:
/** 
 * Completely replaces the contig records in this header with those in the given SAMSequenceDictionary.
 */
public void setSequenceDictionary(final SAMSequenceDictionary dictionary){
  this.contigMetaData.clear();
  for (  final SAMSequenceRecord record : dictionary.getSequences()) {
    contigMetaData.add(new VCFContigHeaderLine(record,null));
  }
  this.mMetaData.addAll(contigMetaData);
}

Fixed version (ground truth):
/** 
 * Completely replaces the contig records in this header with those in the given SAMSequenceDictionary.
 */
public void setSequenceDictionary(final SAMSequenceDictionary dictionary){
  this.contigMetaData.clear();
  final List<VCFHeaderLine> toRemove=new ArrayList<VCFHeaderLine>();
  for (  final VCFHeaderLine line : mMetaData) {
    if (line instanceof VCFContigHeaderLine) {
      toRemove.add(line);
    }
  }
  mMetaData.removeAll(toRemove);
  for (  final SAMSequenceRecord record : dictionary.getSequences()) {
    contigMetaData.add(new VCFContigHeaderLine(record,record.getAssembly()));
  }
  this.mMetaData.addAll(contigMetaData);
}
Program: 30556
Project: 30556
Buggy source:
public static Set<VCFHeaderLine> withUpdatedContigsAsLines(final Set<VCFHeaderLine> oldLines,final File referenceFile,final SAMSequenceDictionary refDict,boolean referenceNameOnly){
  final Set<VCFHeaderLine> lines=new LinkedHashSet<VCFHeaderLine>(oldLines.size());
  for (  final VCFHeaderLine line : oldLines) {
    if (line instanceof VCFContigHeaderLine)     continue;
    if (line.getKey().equals(VCFHeader.REFERENCE_KEY))     continue;
    lines.add(line);
  }
  for (  final VCFHeaderLine contigLine : makeContigHeaderLines(refDict,referenceFile))   lines.add(contigLine);
  String referenceValue;
  if (referenceFile != null) {
    if (referenceNameOnly) {
      int extensionStart=referenceFile.getName().lastIndexOf("String_Node_Str");
      referenceValue=extensionStart == -1 ? referenceFile.getName() : referenceFile.getName().substring(0,extensionStart);
    }
 else {
      referenceValue="String_Node_Str" + referenceFile.getAbsolutePath();
    }
    lines.add(new VCFHeaderLine(VCFHeader.REFERENCE_KEY,referenceValue));
  }
  return lines;
}

Fixed version (ground truth):
public static Set<VCFHeaderLine> withUpdatedContigsAsLines(final Set<VCFHeaderLine> oldLines,final File referenceFile,final SAMSequenceDictionary refDict,final boolean referenceNameOnly){
  final Set<VCFHeaderLine> lines=new LinkedHashSet<VCFHeaderLine>(oldLines.size());
  for (  final VCFHeaderLine line : oldLines) {
    if (line instanceof VCFContigHeaderLine)     continue;
    if (line.getKey().equals(VCFHeader.REFERENCE_KEY))     continue;
    lines.add(line);
  }
  for (  final VCFHeaderLine contigLine : makeContigHeaderLines(refDict,referenceFile))   lines.add(contigLine);
  final String referenceValue;
  if (referenceFile != null) {
    if (referenceNameOnly) {
      final int extensionStart=referenceFile.getName().lastIndexOf("String_Node_Str");
      referenceValue=extensionStart == -1 ? referenceFile.getName() : referenceFile.getName().substring(0,extensionStart);
    }
 else {
      referenceValue="String_Node_Str" + referenceFile.getAbsolutePath();
    }
    lines.add(new VCFHeaderLine(VCFHeader.REFERENCE_KEY,referenceValue));
  }
  return lines;
}
Program: 30558
Project: 30558
Buggy source:
/** 
 * Create VCFHeaderLines for each refDict entry, and optionally the assembly if referenceFile != null
 * @param refDict reference dictionary
 * @param referenceFile for assembly name.  May be null
 * @return list of vcf contig header lines
 */
public static List<VCFContigHeaderLine> makeContigHeaderLines(final SAMSequenceDictionary refDict,final File referenceFile){
  final List<VCFContigHeaderLine> lines=new ArrayList<VCFContigHeaderLine>();
  final String assembly=referenceFile != null ? getReferenceAssembly(referenceFile.getName()) : null;
  for (  SAMSequenceRecord contig : refDict.getSequences())   lines.add(makeContigHeaderLine(contig,assembly));
  return lines;
}

Fixed version (ground truth):
/** 
 * Create VCFHeaderLines for each refDict entry, and optionally the assembly if referenceFile != null
 * @param refDict reference dictionary
 * @param referenceFile for assembly name.  May be null
 * @return list of vcf contig header lines
 */
public static List<VCFContigHeaderLine> makeContigHeaderLines(final SAMSequenceDictionary refDict,final File referenceFile){
  final List<VCFContigHeaderLine> lines=new ArrayList<VCFContigHeaderLine>();
  final String assembly=referenceFile != null ? getReferenceAssembly(referenceFile.getName()) : null;
  for (  final SAMSequenceRecord contig : refDict.getSequences())   lines.add(makeContigHeaderLine(contig,assembly));
  return lines;
}
Program: 30559
Project: 30559
Buggy source:
public static Set<VCFHeaderLine> withUpdatedContigsAsLines(final Set<VCFHeaderLine> oldLines,final File referenceFile,final SAMSequenceDictionary refDict,boolean referenceNameOnly){
  final Set<VCFHeaderLine> lines=new LinkedHashSet<VCFHeaderLine>(oldLines.size());
  for (  final VCFHeaderLine line : oldLines) {
    if (line instanceof VCFContigHeaderLine)     continue;
    if (line.getKey().equals(VCFHeader.REFERENCE_KEY))     continue;
    lines.add(line);
  }
  for (  final VCFHeaderLine contigLine : makeContigHeaderLines(refDict,referenceFile))   lines.add(contigLine);
  String referenceValue;
  if (referenceFile != null) {
    if (referenceNameOnly) {
      int extensionStart=referenceFile.getName().lastIndexOf("String_Node_Str");
      referenceValue=extensionStart == -1 ? referenceFile.getName() : referenceFile.getName().substring(0,extensionStart);
    }
 else {
      referenceValue="String_Node_Str" + referenceFile.getAbsolutePath();
    }
    lines.add(new VCFHeaderLine(VCFHeader.REFERENCE_KEY,referenceValue));
  }
  return lines;
}

Fixed version (ground truth):
public static Set<VCFHeaderLine> withUpdatedContigsAsLines(final Set<VCFHeaderLine> oldLines,final File referenceFile,final SAMSequenceDictionary refDict,final boolean referenceNameOnly){
  final Set<VCFHeaderLine> lines=new LinkedHashSet<VCFHeaderLine>(oldLines.size());
  for (  final VCFHeaderLine line : oldLines) {
    if (line instanceof VCFContigHeaderLine)     continue;
    if (line.getKey().equals(VCFHeader.REFERENCE_KEY))     continue;
    lines.add(line);
  }
  for (  final VCFHeaderLine contigLine : makeContigHeaderLines(refDict,referenceFile))   lines.add(contigLine);
  final String referenceValue;
  if (referenceFile != null) {
    if (referenceNameOnly) {
      final int extensionStart=referenceFile.getName().lastIndexOf("String_Node_Str");
      referenceValue=extensionStart == -1 ? referenceFile.getName() : referenceFile.getName().substring(0,extensionStart);
    }
 else {
      referenceValue="String_Node_Str" + referenceFile.getAbsolutePath();
    }
    lines.add(new VCFHeaderLine(VCFHeader.REFERENCE_KEY,referenceValue));
  }
  return lines;
}
Program: 30561
Project: 30561
Buggy source:
/** 
 * Create VCFHeaderLines for each refDict entry, and optionally the assembly if referenceFile != null
 * @param refDict reference dictionary
 * @param referenceFile for assembly name.  May be null
 * @return list of vcf contig header lines
 */
public static List<VCFContigHeaderLine> makeContigHeaderLines(final SAMSequenceDictionary refDict,final File referenceFile){
  final List<VCFContigHeaderLine> lines=new ArrayList<VCFContigHeaderLine>();
  final String assembly=referenceFile != null ? getReferenceAssembly(referenceFile.getName()) : null;
  for (  SAMSequenceRecord contig : refDict.getSequences())   lines.add(makeContigHeaderLine(contig,assembly));
  return lines;
}

Fixed version (ground truth):
/** 
 * Create VCFHeaderLines for each refDict entry, and optionally the assembly if referenceFile != null
 * @param refDict reference dictionary
 * @param referenceFile for assembly name.  May be null
 * @return list of vcf contig header lines
 */
public static List<VCFContigHeaderLine> makeContigHeaderLines(final SAMSequenceDictionary refDict,final File referenceFile){
  final List<VCFContigHeaderLine> lines=new ArrayList<VCFContigHeaderLine>();
  final String assembly=referenceFile != null ? getReferenceAssembly(referenceFile.getName()) : null;
  for (  final SAMSequenceRecord contig : refDict.getSequences())   lines.add(makeContigHeaderLine(contig,assembly));
  return lines;
}
Program: 30562
Project: 30562
Buggy source:
public boolean equals(MetricBase that){
  for (  Field field : this.getClass().getFields()) {
    try {
      if (!field.get(this).equals(field.get(that))) {
        return false;
      }
    }
 catch (    IllegalAccessException ex) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean equals(MetricBase that){
  for (  Field field : this.getClass().getFields()) {
    try {
      if (!Objects.equals(field.get(this),field.get(that))) {
        return false;
      }
    }
 catch (    IllegalAccessException ex) {
      return false;
    }
  }
  return true;
}
Program: 30563
Project: 30563
Buggy source:
@Override public int readInteger(){
  try {
    final int r=in.read(tmpBuf.array(),0,4);
    if (r != 4)     throw new RuntimeIOException("String_Node_Str" + r);
  }
 catch (  final IOException e) {
    throw new RuntimeIOException(e);
  }
  return tmpBuf.getInt(0);
}

Fixed version (ground truth):
@Override public int readInteger(){
  readFully(in,tmpBuf.array(),0,4);
  return tmpBuf.getInt(0);
}
Program: 30564
Project: 30564
Buggy source:
@Override public long readLong(){
  try {
    final int r=in.read(tmpBuf.array(),0,8);
    if (r != 8)     throw new RuntimeIOException("String_Node_Str" + r);
  }
 catch (  final IOException e) {
    throw new RuntimeIOException(e);
  }
  return tmpBuf.getLong(0);
}

Fixed version (ground truth):
@Override public long readLong(){
  readFully(in,tmpBuf.array(),0,8);
  return tmpBuf.getLong(0);
}
Program: 30565
Project: 30565
Buggy source:
@Override public void readBytes(final byte[] bytes){
  try {
    in.read(bytes);
  }
 catch (  final IOException e) {
    throw new RuntimeIOException(e);
  }
}

Fixed version (ground truth):
@Override public void readBytes(final byte[] bytes){
  readFully(in,bytes,0,bytes.length);
}
Program: 30566
Project: 30566
Buggy source:
@Override public int readInteger(){
  try {
    final int r=in.read(tmpBuf.array(),0,4);
    if (r != 4)     throw new RuntimeIOException("String_Node_Str" + r);
  }
 catch (  final IOException e) {
    throw new RuntimeIOException(e);
  }
  return tmpBuf.getInt(0);
}

Fixed version (ground truth):
@Override public int readInteger(){
  readFully(in,tmpBuf.array(),0,4);
  return tmpBuf.getInt(0);
}
Program: 30567
Project: 30567
Buggy source:
@Override public long readLong(){
  try {
    final int r=in.read(tmpBuf.array(),0,8);
    if (r != 8)     throw new RuntimeIOException("String_Node_Str" + r);
  }
 catch (  final IOException e) {
    throw new RuntimeIOException(e);
  }
  return tmpBuf.getLong(0);
}

Fixed version (ground truth):
@Override public long readLong(){
  readFully(in,tmpBuf.array(),0,8);
  return tmpBuf.getLong(0);
}
Program: 30568
Project: 30568
Buggy source:
@Override public void readBytes(final byte[] bytes){
  try {
    in.read(bytes);
  }
 catch (  final IOException e) {
    throw new RuntimeIOException(e);
  }
}

Fixed version (ground truth):
@Override public void readBytes(final byte[] bytes){
  readFully(in,bytes,0,bytes.length);
}
Program: 30569
Project: 30569
Buggy source:
public boolean equals(MetricBase that){
  for (  Field field : this.getClass().getFields()) {
    try {
      if (!field.get(this).equals(field.get(that))) {
        return false;
      }
    }
 catch (    IllegalAccessException ex) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean equals(MetricBase that){
  for (  Field field : this.getClass().getFields()) {
    try {
      if (!Objects.equals(field.get(this),field.get(that))) {
        return false;
      }
    }
 catch (    IllegalAccessException ex) {
      return false;
    }
  }
  return true;
}
Program: 30570
Project: 30570
Buggy source:
/** 
 * @return A single BAMFileSpan that is an intelligent merge of the input spans, i.e. contiguous, overlappingand contained chunks are intelligently merged, and the chunks are sorted.
 */
public static BAMFileSpan merge(final BAMFileSpan[] spans){
  int numInputChunks=0;
  for (  final BAMFileSpan span : spans)   numInputChunks+=span.chunks.size();
  final ArrayList<Chunk> inputChunks=new ArrayList<Chunk>(numInputChunks);
  for (  final BAMFileSpan span : spans)   inputChunks.addAll(span.chunks);
  return new BAMFileSpan(Chunk.optimizeChunkList(inputChunks,0));
}

Fixed version (ground truth):
/** 
 * @return A single BAMFileSpan that is an intelligent merge of the input spans, i.e. contiguous, overlappingand contained chunks are intelligently merged, and the chunks are sorted.
 */
public static BAMFileSpan merge(final BAMFileSpan[] spans){
  final ArrayList<Chunk> inputChunks=new ArrayList<Chunk>();
  for (  final BAMFileSpan span : spans) {
    if (span != null) {
      inputChunks.addAll(span.chunks);
    }
  }
  return new BAMFileSpan(Chunk.optimizeChunkList(inputChunks,0));
}
Program: 30571
Project: 30571
Buggy source:
/** 
 * Updates the time stored by this instance if it's a "lazy now" instance and has never been stored. 
 */
private synchronized void conditionallyUpdateTime(){
  if (!doSetTimeNextQuery) {
    super.setTime(System.currentTimeMillis());
    doSetTimeNextQuery=false;
  }
}

Fixed version (ground truth):
/** 
 * Updates the time stored by this instance if it's a "lazy now" instance and has never been stored. 
 */
private synchronized void conditionallyUpdateTime(){
  if (doSetTimeNextQuery) {
    super.setTime(System.currentTimeMillis());
    doSetTimeNextQuery=false;
  }
}
Program: 30572
Project: 30572
Buggy source:
@Test public void testLazyInstance(){
  final RelativeIso8601Date lazy=RelativeIso8601Date.generateLazyNowInstance();
  Assert.assertEquals(lazy.toString(),RelativeIso8601Date.LAZY_NOW_LABEL);
  Assert.assertEquals(lazy.toString(),RelativeIso8601Date.LAZY_NOW_LABEL);
  Assert.assertEquals(lazy.toString(),RelativeIso8601Date.LAZY_NOW_LABEL);
  Assert.assertEquals((double)lazy.getTime(),(double)System.currentTimeMillis(),2000d);
  new RelativeIso8601Date(lazy.toString());
}

Fixed version (ground truth):
@Test public void testLazyInstance(){
  final RelativeIso8601Date lazy=RelativeIso8601Date.generateLazyNowInstance();
  Assert.assertEquals(lazy.toString(),RelativeIso8601Date.LAZY_NOW_LABEL);
  Assert.assertEquals(lazy.toString(),RelativeIso8601Date.LAZY_NOW_LABEL);
  Assert.assertEquals(lazy.toString(),RelativeIso8601Date.LAZY_NOW_LABEL);
  Assert.assertEquals(lazy.getTime(),new Iso8601Date(new Date(System.currentTimeMillis())).getTime(),1000);
  new Iso8601Date(lazy.toString());
}
Program: 30573
Project: 30573
Buggy source:
@Test public void testNonLazyInstance(){
  final List<RelativeIso8601Date> testDates=Arrays.<RelativeIso8601Date>asList(new RelativeIso8601Date(new Date()),new RelativeIso8601Date(new Iso8601Date(new Date()).toString()));
  for (  final RelativeIso8601Date nonLazy : testDates) {
    Assert.assertFalse(nonLazy.toString().equals(RelativeIso8601Date.LAZY_NOW_LABEL));
    Assert.assertEquals((double)nonLazy.getTime(),(double)System.currentTimeMillis(),1d);
    new RelativeIso8601Date(nonLazy.toString());
  }
}

Fixed version (ground truth):
@Test public void testNonLazyInstance(){
  final long time=new Iso8601Date(new Date(System.currentTimeMillis())).getTime();
  final List<RelativeIso8601Date> testDates=Arrays.<RelativeIso8601Date>asList(new RelativeIso8601Date(new Date(time)),new RelativeIso8601Date(new Iso8601Date(new Date(time)).toString()));
  for (  final RelativeIso8601Date nonLazy : testDates) {
    Assert.assertFalse(nonLazy.toString().equals(RelativeIso8601Date.LAZY_NOW_LABEL));
    Assert.assertEquals((double)nonLazy.getTime(),(double)time);
    new RelativeIso8601Date(nonLazy.toString());
  }
}
Program: 30574
Project: 30574
Buggy source:
/** 
 * Updates the time stored by this instance if it's a "lazy now" instance and has never been stored. 
 */
private synchronized void conditionallyUpdateTime(){
  if (!doSetTimeNextQuery) {
    super.setTime(System.currentTimeMillis());
    doSetTimeNextQuery=false;
  }
}

Fixed version (ground truth):
/** 
 * Updates the time stored by this instance if it's a "lazy now" instance and has never been stored. 
 */
private synchronized void conditionallyUpdateTime(){
  if (doSetTimeNextQuery) {
    super.setTime(System.currentTimeMillis());
    doSetTimeNextQuery=false;
  }
}
Program: 30575
Project: 30575
Buggy source:
@Test public void testLazyInstance(){
  final RelativeIso8601Date lazy=RelativeIso8601Date.generateLazyNowInstance();
  Assert.assertEquals(lazy.toString(),RelativeIso8601Date.LAZY_NOW_LABEL);
  Assert.assertEquals(lazy.toString(),RelativeIso8601Date.LAZY_NOW_LABEL);
  Assert.assertEquals(lazy.toString(),RelativeIso8601Date.LAZY_NOW_LABEL);
  Assert.assertEquals((double)lazy.getTime(),(double)System.currentTimeMillis(),2000d);
  new RelativeIso8601Date(lazy.toString());
}

Fixed version (ground truth):
@Test public void testLazyInstance(){
  final RelativeIso8601Date lazy=RelativeIso8601Date.generateLazyNowInstance();
  Assert.assertEquals(lazy.toString(),RelativeIso8601Date.LAZY_NOW_LABEL);
  Assert.assertEquals(lazy.toString(),RelativeIso8601Date.LAZY_NOW_LABEL);
  Assert.assertEquals(lazy.toString(),RelativeIso8601Date.LAZY_NOW_LABEL);
  Assert.assertEquals(lazy.getTime(),new Iso8601Date(new Date(System.currentTimeMillis())).getTime(),1000);
  new Iso8601Date(lazy.toString());
}