nus-yam/ex-repair huggingface dataset:
Program: 34998
Project: 34998
Buggy source:
@SuppressWarnings("String_Node_Str") private void init(final Collection<Class<?>> annotatedClasses) throws ODataException {
  try {
    for (    Class<?> clz : annotatedClasses) {
      DataStore<Object> dhs=(DataStore<Object>)DataStore.createInMemory(clz,persistInMemory);
      String entitySetName=ANNOTATION_HELPER.extractEntitySetName(clz);
      dataStores.put(entitySetName,dhs);
    }
  }
 catch (  DataStore.DataStoreException e) {
    throw new ODataException("String_Node_Str" + e.getMessage(),e);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void init(final Collection<Class<?>> annotatedClasses) throws ODataException {
  try {
    for (    Class<?> clz : annotatedClasses) {
      String entitySetName=ANNOTATION_HELPER.extractEntitySetName(clz);
      if (entitySetName != null) {
        DataStore<Object> dhs=(DataStore<Object>)DataStore.createInMemory(clz,persistInMemory);
        dataStores.put(entitySetName,dhs);
      }
 else       if (!ANNOTATION_HELPER.isEdmAnnotated(clz)) {
        throw new ODataException("String_Node_Str" + clz.getName());
      }
    }
  }
 catch (  DataStore.DataStoreException e) {
    throw new ODataException("String_Node_Str" + e.getMessage(),e);
  }
}
Program: 34999
Project: 34999
Buggy source:
public static Map<String,String> extractRequestHeaders(final javax.ws.rs.core.HttpHeaders httpHeaders){
  final MultivaluedMap<String,String> headers=httpHeaders.getRequestHeaders();
  Map<String,String> headerMap=new HashMap<String,String>();
  for (  final String key : headers.keySet()) {
    List<String> header=httpHeaders.getRequestHeader(key);
    if (header != null && !header.isEmpty()) {
      String value=header.get(0);
      if (value != null && !"String_Node_Str".equals(value)) {
        headerMap.put(key,value);
      }
    }
  }
  return headerMap;
}

Fixed version (ground truth):
public static Map<String,String> extractRequestHeaders(final javax.ws.rs.core.HttpHeaders httpHeaders){
  final MultivaluedMap<String,String> headers=httpHeaders.getRequestHeaders();
  Map<String,String> headerMap=new HashMap<String,String>();
  for (  final String key : headers.keySet()) {
    String value=getSafeHeader(key,httpHeaders);
    if (value != null && !"String_Node_Str".equals(value)) {
      headerMap.put(key,value);
    }
  }
  return headerMap;
}
Program: 35000
Project: 35000
Buggy source:
public static ContentType extractRequestContentType(final SubLocatorParameter param) throws ODataUnsupportedMediaTypeException {
  final String contentType=param.getHttpHeaders().getHeaderString(HttpHeaders.CONTENT_TYPE);
  if (contentType == null || contentType.isEmpty()) {
    return ContentType.APPLICATION_OCTET_STREAM;
  }
 else   if (ContentType.isParseable(contentType)) {
    return ContentType.create(contentType);
  }
 else {
    throw new ODataUnsupportedMediaTypeException(ODataUnsupportedMediaTypeException.NOT_SUPPORTED_CONTENT_TYPE.addContent(contentType));
  }
}

Fixed version (ground truth):
public static ContentType extractRequestContentType(final SubLocatorParameter param) throws ODataUnsupportedMediaTypeException {
  String contentType=getSafeHeader(HttpHeaders.CONTENT_TYPE,param.getHttpHeaders());
  if (contentType == null || contentType.isEmpty()) {
    return ContentType.APPLICATION_OCTET_STREAM;
  }
 else   if (ContentType.isParseable(contentType)) {
    return ContentType.create(contentType);
  }
 else {
    throw new ODataUnsupportedMediaTypeException(ODataUnsupportedMediaTypeException.NOT_SUPPORTED_CONTENT_TYPE.addContent(contentType));
  }
}
Program: 35001
Project: 35001
Buggy source:
@Test public void serviceDocumentAcceptHeaderJson() throws Exception {
  final HttpResponse response=callUri("String_Node_Str",HttpHeaders.ACCEPT,HttpContentType.APPLICATION_JSON);
  assertEquals("String_Node_Str" + "String_Node_Str",getBody(response));
}

Fixed version (ground truth):
@Test public void serviceDocumentAcceptHeaderJson() throws Exception {
  final HttpResponse response=callUri("String_Node_Str",HttpHeaders.ACCEPT,HttpContentType.APPLICATION_JSON);
  String body=getBody(response);
  Assert.assertTrue(jsonDataResponseContains(body,"String_Node_Str"));
  Assert.assertTrue(jsonDataResponseContains(body,"String_Node_Str"));
  Assert.assertTrue(jsonDataResponseContains(body,"String_Node_Str"));
  Assert.assertTrue(jsonDataResponseContains(body,"String_Node_Str"));
  Assert.assertTrue(jsonDataResponseContains(body,"String_Node_Str"));
  Assert.assertTrue(jsonDataResponseContains(body,"String_Node_Str"));
}
Program: 35002
Project: 35002
Buggy source:
@Test public void serviceDocumentDollarFormatJson() throws Exception {
  final HttpResponse response=callUri("String_Node_Str");
  assertEquals("String_Node_Str" + "String_Node_Str",getBody(response));
}

Fixed version (ground truth):
@Test public void serviceDocumentDollarFormatJson() throws Exception {
  final HttpResponse response=callUri("String_Node_Str");
  String body=getBody(response);
  Assert.assertTrue(jsonDataResponseContains(body,"String_Node_Str"));
  Assert.assertTrue(jsonDataResponseContains(body,"String_Node_Str"));
  Assert.assertTrue(jsonDataResponseContains(body,"String_Node_Str"));
  Assert.assertTrue(jsonDataResponseContains(body,"String_Node_Str"));
  Assert.assertTrue(jsonDataResponseContains(body,"String_Node_Str"));
  Assert.assertTrue(jsonDataResponseContains(body,"String_Node_Str"));
}
Program: 35003
Project: 35003
Buggy source:
private static URI buildBaseUri(final HttpServletRequest request,final javax.ws.rs.core.UriInfo uriInfo,final List<PathSegment> precedingPathSegments) throws ODataException {
  try {
    UriBuilder uriBuilder=uriInfo.getBaseUriBuilder();
    for (    final PathSegment ps : precedingPathSegments) {
      uriBuilder=uriBuilder.path(ps.getPath());
      for (      final String key : ps.getMatrixParameters().keySet()) {
        final Object[] v=ps.getMatrixParameters().get(key).toArray();
        uriBuilder=uriBuilder.matrixParam(key,v);
      }
    }
    uriBuilder.host(request.getServerName());
    String uriString=uriBuilder.build().toString();
    if (!uriString.endsWith("String_Node_Str")) {
      uriString=uriString + "String_Node_Str";
    }
    return new URI(uriString);
  }
 catch (  final URISyntaxException e) {
    throw new ODataException(e);
  }
}

Fixed version (ground truth):
private static URI buildBaseUri(final HttpServletRequest request,final List<PathSegment> precedingPathSegments) throws ODataException {
  try {
    UriBuilder uriBuilder=UriBuilder.fromUri(request.getServletPath());
    for (    final PathSegment ps : precedingPathSegments) {
      uriBuilder=uriBuilder.path(ps.getPath());
      for (      final String key : ps.getMatrixParameters().keySet()) {
        final Object[] v=ps.getMatrixParameters().get(key).toArray();
        uriBuilder=uriBuilder.matrixParam(key,v);
      }
    }
    uriBuilder.host(request.getServerName()).port(request.getServerPort());
    uriBuilder.scheme(request.getScheme());
    String uriString=uriBuilder.build().toString();
    if (!uriString.endsWith("String_Node_Str")) {
      uriString=uriString + "String_Node_Str";
    }
    return new URI(uriString);
  }
 catch (  final URISyntaxException e) {
    throw new ODataException(e);
  }
}
Program: 35004
Project: 35004
Buggy source:
public static PathInfoImpl buildODataPathInfo(final SubLocatorParameter param) throws ODataException {
  final UriInfo uriInfo=param.getUriInfo();
  PathInfoImpl pathInfo=splitPath(param);
  pathInfo.setServiceRoot(buildBaseUri(param.getServletRequest(),uriInfo,pathInfo.getPrecedingSegments()));
  pathInfo.setRequestUri(uriInfo.getRequestUri());
  return pathInfo;
}

Fixed version (ground truth):
public static PathInfoImpl buildODataPathInfo(final SubLocatorParameter param) throws ODataException {
  PathInfoImpl pathInfo=splitPath(param);
  pathInfo.setServiceRoot(buildBaseUri(param.getServletRequest(),pathInfo.getPrecedingSegments()));
  pathInfo.setRequestUri(buildRequestUri(param.getServletRequest()));
  return pathInfo;
}
Program: 35005
Project: 35005
Buggy source:
/** 
 * Extended test for combination of precision with dates before 1970 (and for regression after 1970)
 */
@Test public void valueToStringDateTimeSpecial() throws Exception {
  for (int precision=0; precision < 3; precision++) {
    try {
      assertValueToStringDateTimeSpecial(1954,7,4,precision);
      fail("String_Node_Str");
    }
 catch (    EdmSimpleTypeException e) {
    }
    try {
      assertValueToStringDateTimeSpecial(1999,7,4,precision);
      fail("String_Node_Str");
    }
 catch (    EdmSimpleTypeException e) {
    }
  }
  for (int precision=3; precision < 6; precision++) {
    assertValueToStringDateTimeSpecial(1954,7,4,precision);
    assertValueToStringDateTimeSpecial(1999,7,4,precision);
  }
}

Fixed version (ground truth):
/** 
 * Extended test for combination of precision with dates before 1970 (and for regression after 1970)
 */
@Test public void valueToStringDateTimeSpecial() throws Exception {
  for (int precision=0; precision < 3; precision++) {
    final EdmSimpleType instance=EdmSimpleTypeKind.DateTime.getEdmSimpleTypeInstance();
    final EdmFacets facets=getPrecisionScaleFacets(precision,null);
    final Calendar date=Calendar.getInstance(TimeZone.getTimeZone("String_Node_Str"));
    date.set(Calendar.MILLISECOND,10 * precision + 1);
    date.set(1954,7,4);
    expectErrorInValueToString(instance,date,EdmLiteralKind.DEFAULT,facets,EdmSimpleTypeException.VALUE_FACETS_NOT_MATCHED);
    date.set(1999,7,4);
    expectErrorInValueToString(instance,date,EdmLiteralKind.DEFAULT,facets,EdmSimpleTypeException.VALUE_FACETS_NOT_MATCHED);
  }
  for (int precision=3; precision < 6; precision++) {
    assertValueToStringDateTimeSpecial(1954,7,4,precision);
    assertValueToStringDateTimeSpecial(1999,7,4,precision);
  }
}
Program: 35006
Project: 35006
Buggy source:
private void assertValueToStringDateTimeSpecial(int year,int month,int day,int precision) throws Exception {
  final EdmSimpleType instance=EdmSimpleTypeKind.DateTime.getEdmSimpleTypeInstance();
  final StringBuilder regExToMatch=new StringBuilder();
  regExToMatch.append(year).append("String_Node_Str");
  if (month < 9) {
    regExToMatch.append("String_Node_Str");
  }
  regExToMatch.append(month + 1).append("String_Node_Str");
  if (day < 10) {
    regExToMatch.append("String_Node_Str");
  }
  regExToMatch.append(day).append("String_Node_Str");
  if (precision > 0) {
    regExToMatch.append("String_Node_Str");
  }
  for (int i=0; i < precision; i++) {
    regExToMatch.append("String_Node_Str");
  }
  Calendar date=Calendar.getInstance(TimeZone.getTimeZone("String_Node_Str"));
  date.set(year,month,day);
  String formated=instance.valueToString(date,EdmLiteralKind.DEFAULT,getPrecisionScaleFacets(precision,null));
  assertTrue("String_Node_Str" + formated + "String_Node_Str"+ precision+ "String_Node_Str"+ regExToMatch.toString()+ "String_Node_Str",formated.matches(regExToMatch.toString()));
}

Fixed version (ground truth):
private void assertValueToStringDateTimeSpecial(int year,int month,int day,int precision) throws Exception {
  final EdmSimpleType instance=EdmSimpleTypeKind.DateTime.getEdmSimpleTypeInstance();
  final StringBuilder regExToMatch=new StringBuilder();
  regExToMatch.append(year).append("String_Node_Str");
  if (month < 9) {
    regExToMatch.append("String_Node_Str");
  }
  regExToMatch.append(month + 1).append("String_Node_Str");
  if (day < 10) {
    regExToMatch.append("String_Node_Str");
  }
  regExToMatch.append(day).append("String_Node_Str");
  if (precision > 0) {
    regExToMatch.append("String_Node_Str");
  }
  for (int i=0; i < precision; i++) {
    regExToMatch.append("String_Node_Str");
  }
  Calendar date=Calendar.getInstance(TimeZone.getTimeZone("String_Node_Str"));
  date.set(year,month,day);
  date.set(Calendar.MILLISECOND,10 * precision + 1);
  String formated=instance.valueToString(date,EdmLiteralKind.DEFAULT,getPrecisionScaleFacets(precision,null));
  assertTrue("String_Node_Str" + formated + "String_Node_Str"+ precision+ "String_Node_Str"+ regExToMatch.toString()+ "String_Node_Str",formated.matches(regExToMatch.toString()));
}
Program: 35007
Project: 35007
Buggy source:
public static void setFacets(final Attribute<?,?> jpaAttribute,final SimpleProperty edmProperty){
  EdmSimpleTypeKind edmTypeKind=edmProperty.getType();
  Facets facets=new Facets();
  edmProperty.setFacets(facets);
  Column column=null;
  if (jpaAttribute.getJavaMember() instanceof AnnotatedElement) {
    column=((AnnotatedElement)jpaAttribute.getJavaMember()).getAnnotation(Column.class);
  }
 else {
    return;
  }
  setNullable(column,edmProperty);
switch (edmTypeKind) {
case Binary:
    setMaxLength(column,edmProperty);
  break;
case DateTime:
setPrecision(column,edmProperty);
break;
case DateTimeOffset:
setPrecision(column,edmProperty);
break;
case Time:
setPrecision(column,edmProperty);
break;
case Decimal:
setPrecision(column,edmProperty);
setScale(column,edmProperty);
break;
case String:
setMaxLength(column,edmProperty);
break;
default :
break;
}
}

Fixed version (ground truth):
public static void setFacets(final Attribute<?,?> jpaAttribute,final SimpleProperty edmProperty){
  EdmSimpleTypeKind edmTypeKind=edmProperty.getType();
  Facets facets=new Facets();
  edmProperty.setFacets(facets);
  Column column=null;
  if (jpaAttribute.getJavaMember() instanceof AnnotatedElement) {
    column=((AnnotatedElement)jpaAttribute.getJavaMember()).getAnnotation(Column.class);
  }
  if (column == null)   return;
  setNullable(column,edmProperty);
switch (edmTypeKind) {
case Binary:
    setMaxLength(column,edmProperty);
  break;
case DateTime:
setPrecision(column,edmProperty);
break;
case DateTimeOffset:
setPrecision(column,edmProperty);
break;
case Time:
setPrecision(column,edmProperty);
break;
case Decimal:
setPrecision(column,edmProperty);
setScale(column,edmProperty);
break;
case String:
setMaxLength(column,edmProperty);
break;
default :
break;
}
}
Program: 35008
Project: 35008
Buggy source:
@Override public void readFromNBT(NBTTagCompound nbt){
  super.readFromNBT(nbt);
  if (node != null && node.host() == this) {
    node.load(nbt.getCompoundTag("String_Node_Str"));
  }
  if (oc_fs != null && oc_fs.node() != null) {
    oc_fs.node().load(nbt.getCompoundTag("String_Node_Str"));
  }
  NBTTagList var2=nbt.getTagList("String_Node_Str",nbt.getId());
  this.CardWriterItemStacks=new ItemStack[this.getSizeInventory()];
  for (int var3=0; var3 < var2.tagCount(); ++var3) {
    NBTTagCompound var4=var2.getCompoundTagAt(var3);
    byte var5=var4.getByte("String_Node_Str");
    if (var5 >= 0 && var5 < this.CardWriterItemStacks.length) {
      this.CardWriterItemStacks[var5]=ItemStack.loadItemStackFromNBT(var4);
    }
  }
}

Fixed version (ground truth):
@Override public void readFromNBT(NBTTagCompound nbt){
  super.readFromNBT(nbt);
  if (node != null && node.host() == this) {
    node.load(nbt.getCompoundTag("String_Node_Str"));
  }
  if (oc_fs != null && oc_fs().node() != null) {
    oc_fs().node().load(nbt.getCompoundTag("String_Node_Str"));
  }
  NBTTagList var2=nbt.getTagList("String_Node_Str",nbt.getId());
  this.CardWriterItemStacks=new ItemStack[this.getSizeInventory()];
  for (int var3=0; var3 < var2.tagCount(); ++var3) {
    NBTTagCompound var4=var2.getCompoundTagAt(var3);
    byte var5=var4.getByte("String_Node_Str");
    if (var5 >= 0 && var5 < this.CardWriterItemStacks.length) {
      this.CardWriterItemStacks[var5]=ItemStack.loadItemStackFromNBT(var4);
    }
  }
}
Program: 35009
Project: 35009
Buggy source:
@Override public void onChunkUnload(){
  super.onChunkUnload();
  if (node != null)   node.remove();
}

Fixed version (ground truth):
@Override public void onChunkUnload(){
  super.onChunkUnload();
  if (node != null) {
    node.remove();
  }
}
Program: 35010
Project: 35010
Buggy source:
@Override public void onConnect(final Node node){
  if (node.host() instanceof Context) {
    node.connect(oc_fs.node());
  }
}

Fixed version (ground truth):
@Override public void onConnect(final Node node){
  if (node == node()) {
    node.connect(oc_fs().node());
  }
}
Program: 35011
Project: 35011
Buggy source:
private void initOCFilesystem(){
  oc_fs=li.cil.oc.api.FileSystem.asManagedEnvironment(li.cil.oc.api.FileSystem.fromClass(OpenSecurity.class,OpenSecurity.MODID,"String_Node_Str"),"String_Node_Str");
  ((Component)oc_fs.node()).setVisibility(Visibility.Neighbors);
}

Fixed version (ground truth):
private void initOCFilesystem(){
  oc_fs=li.cil.oc.api.FileSystem.asManagedEnvironment(li.cil.oc.api.FileSystem.fromClass(OpenSecurity.class,OpenSecurity.MODID,"String_Node_Str"),"String_Node_Str");
  ((Component)oc_fs().node()).setVisibility(Visibility.Network);
}
Program: 35012
Project: 35012
Buggy source:
@Override public void writeToNBT(NBTTagCompound nbt){
  super.writeToNBT(nbt);
  if (node != null && node.host() == this) {
    final NBTTagCompound nodeNbt=new NBTTagCompound();
    node.save(nodeNbt);
    nbt.setTag("String_Node_Str",nodeNbt);
  }
  if (oc_fs != null && oc_fs.node() != null) {
    final NBTTagCompound fsNbt=new NBTTagCompound();
    oc_fs.node().save(fsNbt);
    nbt.setTag("String_Node_Str",fsNbt);
  }
  NBTTagList var2=new NBTTagList();
  for (int var3=0; var3 < this.CardWriterItemStacks.length; ++var3) {
    if (this.CardWriterItemStacks[var3] != null) {
      NBTTagCompound var4=new NBTTagCompound();
      var4.setByte("String_Node_Str",(byte)var3);
      this.CardWriterItemStacks[var3].writeToNBT(var4);
      var2.appendTag(var4);
    }
  }
  nbt.setTag("String_Node_Str",var2);
}

Fixed version (ground truth):
@Override public void writeToNBT(NBTTagCompound nbt){
  super.writeToNBT(nbt);
  if (node != null && node.host() == this) {
    final NBTTagCompound nodeNbt=new NBTTagCompound();
    node.save(nodeNbt);
    nbt.setTag("String_Node_Str",nodeNbt);
  }
  if (oc_fs != null && oc_fs().node() != null) {
    final NBTTagCompound fsNbt=new NBTTagCompound();
    oc_fs().node().save(fsNbt);
    nbt.setTag("String_Node_Str",fsNbt);
  }
  NBTTagList var2=new NBTTagList();
  for (int var3=0; var3 < this.CardWriterItemStacks.length; ++var3) {
    if (this.CardWriterItemStacks[var3] != null) {
      NBTTagCompound var4=new NBTTagCompound();
      var4.setByte("String_Node_Str",(byte)var3);
      this.CardWriterItemStacks[var3].writeToNBT(var4);
      var2.appendTag(var4);
    }
  }
  nbt.setTag("String_Node_Str",var2);
}
Program: 35013
Project: 35013
Buggy source:
@Override public void onDisconnect(final Node node){
  if (node.host() instanceof Context) {
    node.disconnect(oc_fs.node());
  }
 else   if (node == this.node) {
    oc_fs.node().remove();
  }
}

Fixed version (ground truth):
@Override public void onDisconnect(final Node node){
  if (node.host() instanceof Context) {
    node.disconnect(oc_fs().node());
  }
 else   if (node == this.node) {
    oc_fs().node().remove();
  }
}
Program: 35014
Project: 35014
Buggy source:
@Override public void invalidate(){
  super.invalidate();
  if (node != null)   node.remove();
}

Fixed version (ground truth):
@Override public void invalidate(){
  super.invalidate();
  if (node != null) {
    node.remove();
  }
}
Program: 35015
Project: 35015
Buggy source:
@Override public void updateEntity(){
  super.updateEntity();
  if (node != null && node.network() == null) {
    Network.joinOrCreateNetwork(this);
  }
}

Fixed version (ground truth):
@Override public void updateEntity(){
  super.updateEntity();
  if (!addedToNetwork) {
    addToNetwork();
  }
}
Program: 35016
Project: 35016
Buggy source:
@Override public void onNeighborBlockChange(World world,int x,int y,int z,Block block){
  int meta=world.getBlockMetadata(x,y,z);
  if ((meta & 8) == 0) {
    boolean breakBlock=false;
    if (world.getBlock(x,y + 1,z) != this) {
      world.setBlockToAir(x,y,z);
      breakBlock=true;
    }
    if (!World.doesBlockHaveSolidTopSurface(world,x,y - 1,z)) {
      world.setBlockToAir(x,y,z);
      breakBlock=true;
      if (world.getBlock(x,y + 1,z) == this) {
        world.setBlockToAir(x,y + 1,z);
      }
    }
    if (breakBlock) {
      if (!world.isRemote) {
        this.dropBlockAsItem(world,x,y,z,meta,0);
      }
    }
  }
 else {
    if (world.getBlock(x,y - 1,z) != this) {
      world.setBlockToAir(x,y,z);
    }
    if (block != this) {
      this.onNeighborBlockChange(world,x,y - 1,z,block);
    }
  }
}

Fixed version (ground truth):
@Override public void onNeighborBlockChange(World world,int x,int y,int z,Block block){
  int meta=world.getBlockMetadata(x,y,z);
  if ((meta & 8) == 0) {
    boolean breakBlock=false;
    if (world.getBlock(x,y + 1,z) != this) {
      world.setBlockToAir(x,y,z);
      breakBlock=true;
    }
    if (!World.doesBlockHaveSolidTopSurface(world,x,y - 1,z)) {
      world.setBlockToAir(x,y,z);
      breakBlock=true;
      if (world.getBlock(x,y + 1,z) == this) {
        world.setBlockToAir(x,y + 1,z);
      }
    }
    if (breakBlock) {
      if (!world.isRemote) {
      }
    }
  }
 else {
    if (world.getBlock(x,y - 1,z) != this) {
      world.setBlockToAir(x,y,z);
    }
    if (block != this) {
      this.onNeighborBlockChange(world,x,y - 1,z,block);
    }
  }
}
Program: 35017
Project: 35017
Buggy source:
@Override public Object getClientGuiElement(int ID,EntityPlayer player,World world,int x,int y,int z){
  TileEntity te=world.getTileEntity(x,y,z);
  if (te != null && te instanceof TileEntityMagReader) {
    TileEntityMagReader icte=(TileEntityMagReader)te;
    return new MagCardContainer(player.inventory,icte);
  }
 else   if (te != null && te instanceof TileEntityRFIDReader) {
    TileEntityCardWriter icte=(TileEntityCardWriter)te;
    return new RFIDWriterContainer(player.inventory,icte);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public Object getClientGuiElement(int ID,EntityPlayer player,World world,int x,int y,int z){
  TileEntity te=world.getTileEntity(x,y,z);
  if (te != null && te instanceof TileEntityMagReader) {
    TileEntityMagReader icte=(TileEntityMagReader)te;
    return new MagCardContainer(player.inventory,icte);
  }
 else   if (te != null && te instanceof TileEntityRFIDReader) {
    TileEntityCardWriter icte=(TileEntityCardWriter)te;
    return new CardWriterContainer(player.inventory,icte);
  }
 else {
    return null;
  }
}
Program: 35018
Project: 35018
Buggy source:
@Override public Object getClientGuiElement(int ID,EntityPlayer player,World world,int x,int y,int z){
  TileEntity te=world.getTileEntity(x,y,z);
  if (te != null && te instanceof TileEntityRFIDReader) {
    TileEntityCardWriter icte=(TileEntityCardWriter)te;
    return new RFIDWriterContainer(player.inventory,icte);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public Object getClientGuiElement(int ID,EntityPlayer player,World world,int x,int y,int z){
  TileEntity te=world.getTileEntity(x,y,z);
  if (te != null && te instanceof TileEntityRFIDReader) {
    TileEntityCardWriter icte=(TileEntityCardWriter)te;
    return new CardWriterContainer(player.inventory,icte);
  }
 else {
    return null;
  }
}
Program: 35019
Project: 35019
Buggy source:
public boolean isItemValid(ItemStack itemstack){
  if (itemstack.getItem() instanceof ItemRFIDCard || itemstack.getItem() instanceof ItemMagCard || itemstack.getItem() instanceof EEPROM) {
    if (itemstack.stackTagCompound == null || !itemstack.stackTagCompound.hasKey("String_Node_Str") || !itemstack.stackTagCompound.hasKey("String_Node_Str")) {
      return true;
    }
 else {
      return false;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean isItemValid(ItemStack itemstack){
  if (itemstack.getItem() instanceof ItemRFIDCard || itemstack.getItem() instanceof ItemMagCard || itemstack.getItem() instanceof EEPROM) {
    if (itemstack.stackTagCompound == null || !itemstack.stackTagCompound.hasKey("String_Node_Str") || !itemstack.stackTagCompound.hasKey("String_Node_Str")) {
      return true;
    }
 else {
      return false;
    }
  }
  return false;
}
Program: 35020
Project: 35020
Buggy source:
protected double getValue(){
  return mValue;
}

Fixed version (ground truth):
public double getValue(){
  return mValue;
}
Program: 35021
Project: 35021
Buggy source:
/** 
 * Update the value of this fractional currency with the value of the parent currency, presumably after the parent has been updated
 */
public void updateFractionalValue(){
  if (isFractionCurrency() && mParentCurrency != null) {
    setValue(mFraction * mParentCurrency.getValue());
  }
}

Fixed version (ground truth):
/** 
 * Update the value of this fractional currency with the value of the parent currency, presumably after the parent has been updated
 */
public void updateFractionalValue(double parent){
  if (isFractionCurrency()) {
    setValue(mFraction * parent);
  }
}
Program: 35022
Project: 35022
Buggy source:
/** 
 * Load in the update time
 */
@Override public boolean loadJSON(JSONObject json) throws JSONException {
  boolean success=super.loadJSON(json);
  if (success) {
    setUpdateTime(new Date(json.getLong(JSON_LAST_UPDATE)));
  }
  return success;
}

Fixed version (ground truth):
/** 
 * Load in the update time
 */
@Override public boolean loadJSON(JSONObject json) throws JSONException {
  boolean success=super.loadJSON(json);
  if (success) {
    setUpdateDate(new Date(json.getLong(JSON_LAST_UPDATE)));
    mFraction=json.getDouble(JSON_FRACTION_VALUE);
    mParentCurrency=json.getString(JSON_FRACTION_PARENT);
  }
  return success;
}
Program: 35023
Project: 35023
Buggy source:
/** 
 * Save the update time
 */
@Override public JSONObject toJSON() throws JSONException {
  JSONObject json=super.toJSON();
  json.put(JSON_LAST_UPDATE,mTimeLastUpdated.getTime());
  return json;
}

Fixed version (ground truth):
/** 
 * Save the update time
 */
@Override public JSONObject toJSON() throws JSONException {
  JSONObject json=super.toJSON();
  json.put(JSON_LAST_UPDATE,mTimeLastUpdated.getTime());
  json.put(JSON_FRACTION_VALUE,mFraction);
  json.put(JSON_FRACTION_PARENT,mParentCurrency);
  return json;
}
Program: 35024
Project: 35024
Buggy source:
/** 
 * Create a new currency unit that is used for currency units that are fractional sizes of other existing currencies.
 * @param name abbreviated name of the currency (eg, "USD" for US dollar)
 * @param longName long name (eg, "US Dollar")
 * @param value the price of the unit in inverted US dollars
 * @param updateTime the time the price was updated
 * @param unit the symbol for the currency for which this is afraction of (for cents, this would be USD)
 * @param fraction actual fraction of the parent currency
 */
public UnitCurrency(String name,String longName,double value,GregorianCalendar updateTime,UnitCurrency unit,double fraction){
  this(name,longName,value,updateTime);
  mFractionalCurrency=true;
  mParentCurrency=unit;
  mFraction=fraction;
}

Fixed version (ground truth):
/** 
 * Create a new currency unit that is used for currency units that are fractional sizes of other existing currencies.
 * @param name abbreviated name of the currency (eg, "USD" for US dollar)
 * @param longName long name (eg, "US Dollar")
 * @param value the price of the unit in inverted US dollars
 * @param updateTime the time the price was updated
 * @param parent the symbol for the currency for which this is afraction of (for cents, this would be USD)
 * @param fraction actual fraction of the parent currency
 */
public UnitCurrency(String name,String longName,double value,GregorianCalendar updateTime,String parent,double fraction){
  this(name,longName,value,updateTime);
  mParentCurrency=parent;
  mFraction=fraction;
}
Program: 35025
Project: 35025
Buggy source:
public boolean isFractionCurrency(){
  return mFractionalCurrency;
}

Fixed version (ground truth):
public boolean isFractionCurrency(){
  return !mParentCurrency.equals(NO_PARENT);
}
Program: 35027
Project: 35027
Buggy source:
private boolean updateRates(UnitType ut){
  HashMap<String,CurrencyURLParser.Entry> currRates=null;
  HashMap<String,CurrencyURLParser.Entry> cryptCurrRates=null;
  try {
    currRates=new YahooXmlParser().downloadAndParse();
    cryptCurrRates=new CoinmarketcapParser().downloadAndParse();
    cryptCurrRates.putAll(currRates);
    currRates=cryptCurrRates;
  }
 catch (  CurrencyParseException|IOException e) {
    if (e instanceof CurrencyParseException) {
      mErrorCause=ErrorCause.XML_PARSING_ERROR;
    }
 else {
      mErrorCause=ErrorCause.TIMEOUT;
    }
    e.printStackTrace();
  }
  if (currRates == null)   return false;
  for (int i=0; i < ut.size(); i++) {
    if (!ut.getUnitPosInUnitArray(i).isDynamic())     continue;
    UnitCurrency u=((UnitCurrency)ut.getUnitPosInUnitArray(i));
    CurrencyURLParser.Entry entry=currRates.get(u.getAbbreviation());
    if (entry != null) {
      u.setValue(entry.price);
      u.setUpdateTime(entry.date);
    }
 else {
      mUnitsToUpdate.add(i);
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean updateRates(UnitType ut){
  HashMap<String,CurrencyURLParser.Entry> currRates=null;
  HashMap<String,CurrencyURLParser.Entry> cryptCurrRates=null;
  try {
    currRates=new YahooXmlParser().downloadAndParse();
    cryptCurrRates=new CoinmarketcapParser().downloadAndParse();
    cryptCurrRates.putAll(currRates);
    currRates=cryptCurrRates;
  }
 catch (  CurrencyParseException|IOException e) {
    if (e instanceof CurrencyParseException) {
      mErrorCause=ErrorCause.XML_PARSING_ERROR;
    }
 else {
      mErrorCause=ErrorCause.TIMEOUT;
    }
    e.printStackTrace();
  }
  if (currRates == null)   return false;
  for (int i=0; i < ut.size(); i++) {
    if (!ut.getUnitPosInUnitArray(i).isDynamic())     continue;
    UnitCurrency u=((UnitCurrency)ut.getUnitPosInUnitArray(i));
    CurrencyURLParser.Entry entry=currRates.get(u.getAbbreviation());
    if (entry != null) {
      u.setValue(entry.price);
      u.setUpdateDate(entry.date);
    }
 else {
      mUnitsToUpdate.add(i);
    }
  }
  for (int i=0; i < ut.size(); i++) {
    Unit unit=ut.getUnitPosInUnitArray(i);
    if (unit.isDynamic()) {
      UnitCurrency uc=(UnitCurrency)unit;
      if (uc.isFractionCurrency()) {
        UnitCurrency parent=(UnitCurrency)ut.getUnit(uc.getFractionParent());
        double parentValue=ut.getUnit(uc.getFractionParent()).getValue();
        uc.updateFractionalValue(parentValue);
        uc.setUpdateDate(parent.getUpdateDate());
      }
    }
  }
  return true;
}
Program: 35028
Project: 35028
Buggy source:
/** 
 * Perform an update of units inside a UnitType if the timeout period has been reached or if the refresh is forced.
 */
public void update(UnitType ut,boolean forced){
  if (!ut.containsDynamicUnits())   return;
  if (isTimeoutReached(ut) || forced) {
    ut.setUpdating(true);
    new UpdateCurrenciesAsyncTask(ut,forced,mUnitsToUpdate,mContext).execute();
    for (int i=0; i < ut.size(); i++) {
      Unit unit=ut.getUnitPosInUnitArray(i);
      if (unit.isDynamic()) {
        UnitCurrency uc=(UnitCurrency)unit;
        if (uc.isFractionCurrency())         uc.updateFractionalValue();
      }
    }
  }
 else {
    ViewUtils.toast(mContext.getText(R.string.words_units_up_to_date).toString(),mContext);
  }
}

Fixed version (ground truth):
/** 
 * Perform an update of units inside a UnitType if the timeout period has been reached or if the refresh is forced.
 */
public void update(UnitType ut,boolean forced){
  if (!ut.containsDynamicUnits())   return;
  if (isTimeoutReached(ut) || forced) {
    ut.setUpdating(true);
    new UpdateCurrenciesAsyncTask(ut,forced,mUnitsToUpdate,mContext).execute();
  }
 else {
    ViewUtils.toast(mContext.getText(R.string.words_units_up_to_date).toString(),mContext);
  }
}
Program: 35029
Project: 35029
Buggy source:
public int findButtonPositionforUnitArrayPos(int pos){
  return mUnitDisplayOrder.indexOf(pos);
}

Fixed version (ground truth):
/** 
 * This function takes a unit array position (the original position of a unit when the unit array is created in code) and returns the display order position (after units have been moved around by the user.
 * @param pos the position of the unit in the original unit array
 * @return the position of the unit in the display order array
 */
public int findButtonPositionforUnitArrayPos(int pos){
  return mUnitDisplayOrder.indexOf(pos);
}
Program: 35031
Project: 35031
Buggy source:
@Test public void testCheckUnitTypeNames(){
  clickButtons("String_Node_Str");
  checkUnitTypesRemoved(new ArrayList<String>());
  selectUnitTypeDirect("String_Node_Str");
  clickUnit("String_Node_Str");
  clickUnit("String_Node_Str");
  ArrayList<String> toRemoveArray=new ArrayList<>();
  toRemoveArray.add("String_Node_Str");
  toRemoveArray.add("String_Node_Str");
  toRemoveArray.add("String_Node_Str");
  toRemoveArray.add("String_Node_Str");
  hideUnitTypes(toRemoveArray);
  checkUnitTypesRemoved(toRemoveArray);
  clickPrevAnswer();
  toRemoveArray.remove("String_Node_Str");
  checkUnitTypesRemoved(toRemoveArray);
  ArrayList<String> toRemoveArray2=new ArrayList<>();
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  hideUnitTypes(toRemoveArray2);
  toRemoveArray.addAll(toRemoveArray2);
  checkUnitTypesRemoved(toRemoveArray);
}

Fixed version (ground truth):
@Test public void testCheckUnitTypeNames(){
  clickButtons("String_Node_Str");
  checkUnitTypesRemoved(new ArrayList<String>());
  selectUnitTypeDirect("String_Node_Str");
  clickUnit("String_Node_Str");
  clickUnit("String_Node_Str");
  selectUnitTypeDirect("String_Node_Str");
  clickUnit("String_Node_Str");
  checkUnitButtonVisible("String_Node_Str");
  checkUnitButtonVisibleWithArrow("String_Node_Str");
  selectUnitTypeDirect("String_Node_Str");
  checkUnitButtonVisible("String_Node_Str");
  checkUnitButtonVisible("String_Node_Str");
  selectUnitTypeDirect("String_Node_Str");
  checkUnitButtonVisible("String_Node_Str");
  ArrayList<String> toRemoveArray=new ArrayList<>();
  toRemoveArray.add("String_Node_Str");
  toRemoveArray.add("String_Node_Str");
  toRemoveArray.add("String_Node_Str");
  toRemoveArray.add("String_Node_Str");
  hideUnitTypes(toRemoveArray);
  checkUnitTypesRemoved(toRemoveArray);
  clickPrevAnswer();
  toRemoveArray.remove("String_Node_Str");
  checkUnitTypesRemoved(toRemoveArray);
  ArrayList<String> toRemoveArray2=new ArrayList<>();
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  toRemoveArray2.add("String_Node_Str");
  hideUnitTypes(toRemoveArray2);
  toRemoveArray.addAll(toRemoveArray2);
  checkUnitTypesRemoved(toRemoveArray);
}
Program: 35032
Project: 35032
Buggy source:
@Override public void onPageSelected(int pos){
  mCalc.setCurrentUnitTypePos(pos);
  if (mCalc.getCurrUnitType().containsDynamicUnits())   mCalc.refreshAllDynamicUnits(false);
  int currUnitTypePos=mUnitTypeViewPager.getCurrentItem();
  clearUnitSelection(currUnitTypePos - 1);
  clearUnitSelection(currUnitTypePos);
  clearUnitSelection(currUnitTypePos + 1);
  mCalc.getCurrUnitType().clearUnitSelection();
  if (unitPosToSelectAfterScroll != -1) {
    ConvKeysFragment frag=getConvKeyFrag(mUnitTypeViewPager.getCurrentItem());
    if (frag != null)     frag.selectUnitAtUnitArrayPos(unitPosToSelectAfterScroll);
    unitPosToSelectAfterScroll=-1;
  }
  updateScreen(false);
  mDisplay.setSelectionToEnd();
}

Fixed version (ground truth):
@Override public void onPageSelected(int pos){
  mCalc.getCurrUnitType().clearUnitSelection();
  mCalc.setCurrentUnitTypePos(pos);
  if (mCalc.getCurrUnitType().containsDynamicUnits())   mCalc.refreshAllDynamicUnits(false);
  int currUnitTypePos=mUnitTypeViewPager.getCurrentItem();
  clearUnitSelection(currUnitTypePos - 1);
  clearUnitSelection(currUnitTypePos);
  clearUnitSelection(currUnitTypePos + 1);
  mCalc.getCurrUnitType().clearUnitSelection();
  if (unitPosToSelectAfterScroll != -1) {
    ConvKeysFragment frag=getConvKeyFrag(mUnitTypeViewPager.getCurrentItem());
    if (frag != null)     frag.selectUnitAtUnitArrayPos(unitPosToSelectAfterScroll);
    unitPosToSelectAfterScroll=-1;
  }
  updateScreen(false);
  mDisplay.setSelectionToEnd();
}
Program: 35034
Project: 35034
Buggy source:
/** 
 * Clears the button unit selection
 */
public void clearButtonSelection(){
  if (mConvButton == null)   return;
  for (int i=0; i < mConvButton.size(); i++) {
    refreshButtonText(i);
  }
  setSelectedButtonHighlight(false);
}

Fixed version (ground truth):
/** 
 * Clears the button unit selection
 */
public void clearButtonSelection(){
  if (mConvButton == null)   return;
  for (int i=0; i < mConvButton.size(); i++) {
    refreshButtonText("String_Node_Str",i);
  }
  setSelectedButtonHighlight(false);
}
Program: 35035
Project: 35035
Buggy source:
@Override public String getDescription(){
  return "String_Node_Str";
}

Fixed version (ground truth):
@Override public String getDescription(){
  return "String_Node_Str" + unitTypeName;
}
Program: 35036
Project: 35036
Buggy source:
/** 
 * Clicks on the tab for the provided Unit Type name. Note that the Unit Type doesn't need to be visible.
 */
public static void selectUnitTypeDirect(String unitTypeName){
  onView(allOf(withText(unitTypeName))).perform(new ViewAction(){
    @Override public Matcher<View> getConstraints(){
      return isEnabled();
    }
    @Override public String getDescription(){
      return "String_Node_Str";
    }
    @Override public void perform(    UiController uiController,    View view){
      view.performClick();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Clicks on the tab for the provided Unit Type name. Note that the Unit Type doesn't need to be visible.
 */
public static void selectUnitTypeDirect(final String unitTypeName){
  onView(allOf(withText(unitTypeName))).perform(new ViewAction(){
    @Override public Matcher<View> getConstraints(){
      return isEnabled();
    }
    @Override public String getDescription(){
      return "String_Node_Str" + unitTypeName;
    }
    @Override public void perform(    UiController uiController,    View view){
      view.performClick();
    }
  }
);
}
Program: 35038
Project: 35038
Buggy source:
@Override public void onPageSelected(int pos){
  mCalc.getCurrUnitType().clearUnitSelection();
  mCalc.setCurrentUnitTypePos(pos);
  if (mCalc.getCurrUnitType().containsDynamicUnits())   mCalc.refreshAllDynamicUnits(false);
  int currUnitTypePos=mUnitTypeViewPager.getCurrentItem();
  clearUnitSelection(currUnitTypePos - 1);
  clearUnitSelection(currUnitTypePos);
  clearUnitSelection(currUnitTypePos + 1);
  mCalc.getCurrUnitType().clearUnitSelection();
  if (unitPosToSelectAfterScroll != -1) {
    ConvKeysFragment frag=getConvKeyFrag(mUnitTypeViewPager.getCurrentItem());
    if (frag != null)     frag.selectUnitAtUnitArrayPos(unitPosToSelectAfterScroll);
    unitPosToSelectAfterScroll=-1;
  }
  updateScreen(false);
  mDisplay.setSelectionToEnd();
}

Fixed version (ground truth):
@Override public void onPageSelected(int pos){
  mCalc.getCurrUnitType().clearUnitSelection();
  mCalc.setCurrentUnitTypePos(pos);
  if (mCalc.getCurrUnitType().containsDynamicUnits())   mCalc.refreshAllDynamicUnits(false);
  int currUnitTypePos=mUnitTypeViewPager.getCurrentItem();
  clearUnitSelection(currUnitTypePos - 1);
  clearUnitSelection(currUnitTypePos);
  clearUnitSelection(currUnitTypePos + 1);
  mCalc.getCurrUnitType().clearUnitSelection();
  if (unitPosToSelectAfterScroll != -1) {
    ConvKeysFragment frag=getConvKeyFrag(mUnitTypeViewPager.getCurrentItem());
    if (frag != null)     frag.selectUnitAtUnitArrayPos(unitPosToSelectAfterScroll);
    unitPosToSelectAfterScroll=-1;
  }
  updateScreen(true);
  mDisplay.setSelectionToEnd();
}
Program: 35040
Project: 35040
Buggy source:
private void tryConvert(int buttonPos){
  clearButtonSelection();
  boolean requestConvert=mUnitType.selectUnit(buttonPos);
  Calculator calc=Calculator.getCalculator(getActivity());
  if (requestConvert) {
    calc.convertFromTo(mUnitType.getPrevUnit(),mUnitType.getCurrUnit());
    clearButtonSelection();
  }
 else   if (mUnitType.isUnitSelected()) {
    if (calc.isExpressionEmpty()) {
      calc.parseKeyPressed("String_Node_Str");
      calc.setSelection(0,calc.toString().length());
    }
    colorSelectedButton();
  }
  mCallback.updateScreen(true);
}

Fixed version (ground truth):
private void tryConvert(int buttonPos){
  clearButtonSelection();
  boolean requestConvert=mUnitType.selectUnit(buttonPos);
  Calculator calc=Calculator.getCalculator(getActivity());
  if (requestConvert) {
    calc.convertFromTo(mUnitType.getPrevUnit(),mUnitType.getCurrUnit());
    clearButtonSelection();
  }
 else   if (mUnitType.isUnitSelected()) {
    calc.setSolved(false);
    if (calc.isExpressionEmpty()) {
      calc.parseKeyPressed("String_Node_Str");
      calc.setSelection(0,calc.toString().length());
    }
    colorSelectedButton();
  }
  mCallback.updateScreen(true);
}
Program: 35041
Project: 35041
Buggy source:
private void setSelectedButtonHighlight(boolean highlighted){
  mCallback.setEqualButtonColor(highlighted);
  if (mUnitType.getCurrUnitButtonPos() < mNumConvButtons) {
    int currButtonPos=mUnitType.getCurrUnitButtonPos();
    if (currButtonPos == -1)     return;
    mConvButton.get(currButtonPos).setSelected(highlighted);
  }
}

Fixed version (ground truth):
private void setSelectedButtonHighlight(boolean highlighted){
  mCallback.setEqualButtonColor(highlighted);
  if (mUnitType.getCurrUnitButtonPos() < mNumConvButtons) {
    int currButtonPos=mUnitType.getCurrUnitButtonPos();
    if (currButtonPos == -1)     return;
    if (currButtonPos >= mConvButton.size())     return;
    mConvButton.get(currButtonPos).setSelected(highlighted);
  }
}
Program: 35042
Project: 35042
Buggy source:
@Test public void testCalcActivity(){
  clickButtons("String_Node_Str");
  assertExpressionEquals("String_Node_Str");
  clickButtons("String_Node_Str");
  assertExpressionEquals("String_Node_Str");
  clickButtons("String_Node_Str");
  assertExpressionEquals("String_Node_Str");
  clickButtons("String_Node_Str");
  assertExpressionEquals("String_Node_Str");
  clickButtons("String_Node_Str");
  assertExpressionEquals("String_Node_Str");
  clickButtons("String_Node_Str");
  assertExpressionEquals("String_Node_Str");
  clickButtons("String_Node_Str");
  assertExpressionEquals("String_Node_Str");
}

Fixed version (ground truth):
@Test public void testCalcActivity(){
  clickButtons("String_Node_Str");
  assertExpressionEquals("String_Node_Str");
  assertResultPreviewInvisible();
  clickButtons("String_Node_Str");
  assertExpressionEquals("String_Node_Str");
  clickButtons("String_Node_Str");
  assertExpressionEquals("String_Node_Str");
  clickButtons("String_Node_Str");
  assertExpressionEquals("String_Node_Str");
  assertResultPreviewEquals("String_Node_Str");
  clickButtons("String_Node_Str");
  assertExpressionEquals("String_Node_Str");
  clickButtons("String_Node_Str");
  assertExpressionEquals("String_Node_Str");
  assertResultPreviewEquals("String_Node_Str");
  clickButtons("String_Node_Str");
  assertExpressionEquals("String_Node_Str");
  assertResultPreviewInvisible();
}
Program: 35043
Project: 35043
Buggy source:
private void resetSharedPrefs(){
  File root=InstrumentationRegistry.getTargetContext().getFilesDir().getParentFile();
  String[] sharedPreferencesFileNames=new File(root,"String_Node_Str").list();
  for (  String fileName : sharedPreferencesFileNames) {
    InstrumentationRegistry.getTargetContext().getSharedPreferences(fileName.replace("String_Node_Str","String_Node_Str"),Context.MODE_PRIVATE).edit().clear().apply();
  }
}

Fixed version (ground truth):
private void resetSharedPrefs(){
  File root=InstrumentationRegistry.getTargetContext().getFilesDir().getParentFile();
  String[] sharedPreferencesFileNames=new File(root,"String_Node_Str").list();
  if (sharedPreferencesFileNames == null)   return;
  for (  String fileName : sharedPreferencesFileNames) {
    InstrumentationRegistry.getTargetContext().getSharedPreferences(fileName.replace("String_Node_Str","String_Node_Str"),Context.MODE_PRIVATE).edit().clear().apply();
  }
}
Program: 35044
Project: 35044
Buggy source:
/** 
 * Used to get text to display by the TextView
 * @param suffixColor is the color of the SI suffix if the result in thepreview is set to {@link com.llamacorp.equate.Expression.NumFormat#ENGINEERING}
 * @return an HTML formatted result with the SI suffix in brackets ifapplicable
 */
public Spanned getText(int suffixColor){
  String suffix="String_Node_Str";
  if (mNumFormat == Expression.NumFormat.ENGINEERING) {
    String suffixText=SISuffixHelper.getSuffixName(mText);
    if (!suffixText.isEmpty())     suffix="String_Node_Str" + SISuffixHelper.getSuffixName(mText) + "String_Node_Str";
  }
  if (!"String_Node_Str".equals(mText))   mText="String_Node_Str" + mText;
  return ViewUtils.fromHtml(mText + "String_Node_Str" + suffixColor+ "String_Node_Str"+ suffix+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Used to get text to display by the TextView
 * @param suffixColor is the color of the SI suffix if the result in thepreview is set to {@link com.llamacorp.equate.Expression.NumFormat#ENGINEERING}
 * @return an HTML formatted result with the SI suffix in brackets ifapplicable
 */
public Spanned getText(int suffixColor){
  String suffix="String_Node_Str";
  if (mNumFormat == Expression.NumFormat.ENGINEERING) {
    String suffixText=SISuffixHelper.getSuffixName(mText);
    if (!suffixText.isEmpty())     suffix="String_Node_Str" + SISuffixHelper.getSuffixName(mText) + "String_Node_Str";
  }
  String returnText=mText;
  if (!"String_Node_Str".equals(mText))   returnText="String_Node_Str" + mText;
  return ViewUtils.fromHtml(returnText + "String_Node_Str" + suffixColor+ "String_Node_Str"+ suffix+ "String_Node_Str");
}
Program: 35045
Project: 35045
Buggy source:
/** 
 * Used to get text to display by the TextView
 * @param suffixColor is the color of the SI suffix if the result in thepreview is set to {@link com.llamacorp.equate.Expression.NumFormat#ENGINEERING}
 * @return an HTML formatted result with the SI suffix in brackets ifapplicable
 */
public Spanned getText(int suffixColor){
  String suffix="String_Node_Str";
  if (mNumFormat == Expression.NumFormat.ENGINEERING) {
    String suffixText=SISuffixHelper.getSuffixName(mText);
    if (!suffixText.isEmpty())     suffix="String_Node_Str" + SISuffixHelper.getSuffixName(mText) + "String_Node_Str";
  }
  return Html.fromHtml("String_Node_Str" + mText + "String_Node_Str"+ suffixColor+ "String_Node_Str"+ suffix+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Used to get text to display by the TextView
 * @param suffixColor is the color of the SI suffix if the result in thepreview is set to {@link com.llamacorp.equate.Expression.NumFormat#ENGINEERING}
 * @return an HTML formatted result with the SI suffix in brackets ifapplicable
 */
public Spanned getText(int suffixColor){
  String suffix="String_Node_Str";
  if (mNumFormat == Expression.NumFormat.ENGINEERING) {
    String suffixText=SISuffixHelper.getSuffixName(mText);
    if (!suffixText.isEmpty())     suffix="String_Node_Str" + SISuffixHelper.getSuffixName(mText) + "String_Node_Str";
  }
  if (!"String_Node_Str".equals(mText))   mText="String_Node_Str" + mText;
  return ViewUtils.fromHtml(mText + "String_Node_Str" + suffixColor+ "String_Node_Str"+ suffix+ "String_Node_Str");
}