nus-yam/ex-repair huggingface dataset:
Program: 25582
Project: 25582
Buggy source:
public void testSimplifyMultipleBounds(){
  TypeElement multipleBoundsElement=typeElementOf("String_Node_Str");
  TypeMirror multipleBoundsMirror=multipleBoundsElement.asType();
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",ImmutableSet.of(multipleBoundsMirror));
  assertEquals(ImmutableSet.of("String_Node_Str"),typeSimplifier.typesToImport());
  assertEquals("String_Node_Str",typeSimplifier.simplify(multipleBoundsMirror));
  assertEquals("String_Node_Str",typeSimplifier.formalTypeParametersString(multipleBoundsElement));
}

Fixed version (ground truth):
public void testSimplifyMultipleBounds(){
  TypeElement multipleBoundsElement=typeElementOf("String_Node_Str");
  TypeMirror multipleBoundsMirror=multipleBoundsElement.asType();
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",ImmutableSet.of(multipleBoundsMirror),baseWithoutContainedTypes());
  assertEquals(ImmutableSet.of("String_Node_Str"),typeSimplifier.typesToImport());
  assertEquals("String_Node_Str",typeSimplifier.simplify(multipleBoundsMirror));
  assertEquals("String_Node_Str",typeSimplifier.formalTypeParametersString(multipleBoundsElement));
}
Program: 25583
Project: 25583
Buggy source:
public void testImportsForNoTypes(){
  Set<TypeMirror> types=ImmutableSet.of();
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types);
  assertEquals(ImmutableSet.of(),typeSimplifier.typesToImport());
}

Fixed version (ground truth):
public void testImportsForNoTypes(){
  Set<TypeMirror> types=ImmutableSet.of();
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types,baseWithoutContainedTypes());
  assertEquals(ImmutableSet.of(),typeSimplifier.typesToImport());
}
Program: 25584
Project: 25584
Buggy source:
public void testSimplifyAmbiguousNames(){
  TypeMirror javaAwtList=typeMirrorOf("String_Node_Str");
  TypeMirror javaUtilList=typeMirrorOf("String_Node_Str");
  Set<TypeMirror> types=ImmutableSet.of(javaAwtList,javaUtilList);
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types);
  assertEquals(javaAwtList.toString(),typeSimplifier.simplify(javaAwtList));
  assertEquals(javaUtilList.toString(),typeSimplifier.simplify(javaUtilList));
}

Fixed version (ground truth):
public void testSimplifyAmbiguousNames(){
  TypeMirror javaAwtList=typeMirrorOf("String_Node_Str");
  TypeMirror javaUtilList=typeMirrorOf("String_Node_Str");
  Set<TypeMirror> types=ImmutableSet.of(javaAwtList,javaUtilList);
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types,baseWithoutContainedTypes());
  assertEquals(javaAwtList.toString(),typeSimplifier.simplify(javaAwtList));
  assertEquals(javaUtilList.toString(),typeSimplifier.simplify(javaUtilList));
}
Program: 25585
Project: 25585
Buggy source:
public void testImportsForArrayTypes(){
  TypeElement list=typeElementOf("String_Node_Str");
  TypeElement set=typeElementOf("String_Node_Str");
  Set<TypeMirror> types=ImmutableSet.<TypeMirror>of(typeUtil.getArrayType(typeUtil.getPrimitiveType(TypeKind.INT)),typeUtil.getArrayType(typeMirrorOf("String_Node_Str")),typeUtil.getArrayType(typeUtil.getDeclaredType(set,typeUtil.getArrayType(typeMirrorOf("String_Node_Str")))),typeUtil.getDeclaredType(list,typeUtil.getArrayType(typeMirrorOf("String_Node_Str"))));
  List<String> expectedImports=ImmutableList.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types);
  assertEquals(expectedImports,ImmutableList.copyOf(typeSimplifier.typesToImport()));
}

Fixed version (ground truth):
public void testImportsForArrayTypes(){
  TypeElement list=typeElementOf("String_Node_Str");
  TypeElement set=typeElementOf("String_Node_Str");
  Set<TypeMirror> types=ImmutableSet.<TypeMirror>of(typeUtil.getArrayType(typeUtil.getPrimitiveType(TypeKind.INT)),typeUtil.getArrayType(typeMirrorOf("String_Node_Str")),typeUtil.getArrayType(typeUtil.getDeclaredType(set,typeUtil.getArrayType(typeMirrorOf("String_Node_Str")))),typeUtil.getDeclaredType(list,typeUtil.getArrayType(typeMirrorOf("String_Node_Str"))));
  List<String> expectedImports=ImmutableList.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types,baseWithoutContainedTypes());
  assertEquals(expectedImports,ImmutableList.copyOf(typeSimplifier.typesToImport()));
}
Program: 25586
Project: 25586
Buggy source:
public void testSimplifyJavaLangString(){
  TypeMirror string=typeMirrorOf("String_Node_Str");
  Set<TypeMirror> types=ImmutableSet.of(string);
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types);
  assertEquals("String_Node_Str",typeSimplifier.simplify(string));
}

Fixed version (ground truth):
public void testSimplifyJavaLangString(){
  TypeMirror string=typeMirrorOf("String_Node_Str");
  Set<TypeMirror> types=ImmutableSet.of(string);
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types,baseWithoutContainedTypes());
  assertEquals("String_Node_Str",typeSimplifier.simplify(string));
}
Program: 25587
Project: 25587
Buggy source:
public void testImportsForPlainTypes(){
  Set<TypeMirror> types=ImmutableSet.of(typeUtil.getPrimitiveType(TypeKind.INT),typeMirrorOf("String_Node_Str"),typeMirrorOf("String_Node_Str"),typeMirrorOf("String_Node_Str"),typeMirrorOf("String_Node_Str"),typeMirrorOf("String_Node_Str"));
  List<String> expectedImports=ImmutableList.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types);
  assertEquals(expectedImports,ImmutableList.copyOf(typeSimplifier.typesToImport()));
}

Fixed version (ground truth):
public void testImportsForPlainTypes(){
  Set<TypeMirror> types=ImmutableSet.of(typeUtil.getPrimitiveType(TypeKind.INT),typeMirrorOf("String_Node_Str"),typeMirrorOf("String_Node_Str"),typeMirrorOf("String_Node_Str"),typeMirrorOf("String_Node_Str"),typeMirrorOf("String_Node_Str"));
  List<String> expectedImports=ImmutableList.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types,baseWithoutContainedTypes());
  assertEquals(expectedImports,ImmutableList.copyOf(typeSimplifier.typesToImport()));
}
Program: 25588
Project: 25588
Buggy source:
public void testImportsForAmbiguousNames(){
  Set<TypeMirror> types=ImmutableSet.of(typeUtil.getPrimitiveType(TypeKind.INT),typeMirrorOf("String_Node_Str"),typeMirrorOf("String_Node_Str"),typeMirrorOf("String_Node_Str"),typeMirrorOf("String_Node_Str"));
  List<String> expectedImports=ImmutableList.of("String_Node_Str");
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types);
  assertEquals(expectedImports,ImmutableList.copyOf(typeSimplifier.typesToImport()));
}

Fixed version (ground truth):
public void testImportsForAmbiguousNames(){
  Set<TypeMirror> types=ImmutableSet.of(typeUtil.getPrimitiveType(TypeKind.INT),typeMirrorOf("String_Node_Str"),typeMirrorOf("String_Node_Str"),typeMirrorOf("String_Node_Str"),typeMirrorOf("String_Node_Str"));
  List<String> expectedImports=ImmutableList.of("String_Node_Str");
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types,baseWithoutContainedTypes());
  assertEquals(expectedImports,ImmutableList.copyOf(typeSimplifier.typesToImport()));
}
Program: 25589
Project: 25589
Buggy source:
public void testImportsForImplicitlyImportedTypes(){
  Set<TypeMirror> types=ImmutableSet.of(typeMirrorOf("String_Node_Str"),typeMirrorOf("String_Node_Str"),typeUtil.getPrimitiveType(TypeKind.INT),typeUtil.getPrimitiveType(TypeKind.BOOLEAN));
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types);
  assertEquals(ImmutableSet.of(),typeSimplifier.typesToImport());
}

Fixed version (ground truth):
public void testImportsForImplicitlyImportedTypes(){
  Set<TypeMirror> types=ImmutableSet.of(typeMirrorOf("String_Node_Str"),typeMirrorOf("String_Node_Str"),typeUtil.getPrimitiveType(TypeKind.INT),typeUtil.getPrimitiveType(TypeKind.BOOLEAN));
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types,baseWithoutContainedTypes());
  assertEquals(ImmutableSet.of(),typeSimplifier.typesToImport());
}
Program: 25590
Project: 25590
Buggy source:
public void testSimplifyComplicatedTypes(){
  TypeElement list=typeElementOf("String_Node_Str");
  TypeElement map=typeElementOf("String_Node_Str");
  TypeMirror string=typeMirrorOf("String_Node_Str");
  TypeMirror integer=typeMirrorOf("String_Node_Str");
  TypeMirror pattern=typeMirrorOf("String_Node_Str");
  TypeMirror timer=typeMirrorOf("String_Node_Str");
  TypeMirror bigInteger=typeMirrorOf("String_Node_Str");
  Set<TypeMirror> types=ImmutableSet.of(typeUtil.getPrimitiveType(TypeKind.INT),typeUtil.getArrayType(typeUtil.getPrimitiveType(TypeKind.BYTE)),pattern,typeUtil.getArrayType(pattern),typeUtil.getArrayType(typeUtil.getArrayType(pattern)),typeUtil.getDeclaredType(list,typeUtil.getWildcardType(null,null)),typeUtil.getDeclaredType(list,timer),typeUtil.getDeclaredType(map,string,integer),typeUtil.getDeclaredType(map,typeUtil.getWildcardType(timer,null),typeUtil.getWildcardType(null,bigInteger)));
  List<String> expectedSimplifications=ImmutableList.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types);
  List<String> actualSimplifications=new ArrayList<String>();
  for (  TypeMirror type : types) {
    actualSimplifications.add(typeSimplifier.simplify(type));
  }
  assertEquals(expectedSimplifications,actualSimplifications);
}

Fixed version (ground truth):
public void testSimplifyComplicatedTypes(){
  TypeElement list=typeElementOf("String_Node_Str");
  TypeElement map=typeElementOf("String_Node_Str");
  TypeMirror string=typeMirrorOf("String_Node_Str");
  TypeMirror integer=typeMirrorOf("String_Node_Str");
  TypeMirror pattern=typeMirrorOf("String_Node_Str");
  TypeMirror timer=typeMirrorOf("String_Node_Str");
  TypeMirror bigInteger=typeMirrorOf("String_Node_Str");
  Set<TypeMirror> types=ImmutableSet.of(typeUtil.getPrimitiveType(TypeKind.INT),typeUtil.getArrayType(typeUtil.getPrimitiveType(TypeKind.BYTE)),pattern,typeUtil.getArrayType(pattern),typeUtil.getArrayType(typeUtil.getArrayType(pattern)),typeUtil.getDeclaredType(list,typeUtil.getWildcardType(null,null)),typeUtil.getDeclaredType(list,timer),typeUtil.getDeclaredType(map,string,integer),typeUtil.getDeclaredType(map,typeUtil.getWildcardType(timer,null),typeUtil.getWildcardType(null,bigInteger)));
  List<String> expectedSimplifications=ImmutableList.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types,baseWithoutContainedTypes());
  List<String> actualSimplifications=new ArrayList<String>();
  for (  TypeMirror type : types) {
    actualSimplifications.add(typeSimplifier.simplify(type));
  }
  assertEquals(expectedSimplifications,actualSimplifications);
}
Program: 25591
Project: 25591
Buggy source:
public void testImportsForComplicatedTypes(){
  TypeElement list=typeElementOf("String_Node_Str");
  TypeElement map=typeElementOf("String_Node_Str");
  Set<TypeMirror> types=ImmutableSet.of(typeUtil.getPrimitiveType(TypeKind.INT),typeMirrorOf("String_Node_Str"),typeUtil.getDeclaredType(list,typeMirrorOf("String_Node_Str")),typeUtil.getDeclaredType(map,typeUtil.getWildcardType(typeMirrorOf("String_Node_Str"),null),typeUtil.getWildcardType(null,typeMirrorOf("String_Node_Str"))));
  List<String> expectedImports=ImmutableList.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types);
  assertEquals(expectedImports,ImmutableList.copyOf(typeSimplifier.typesToImport()));
}

Fixed version (ground truth):
public void testImportsForComplicatedTypes(){
  TypeElement list=typeElementOf("String_Node_Str");
  TypeElement map=typeElementOf("String_Node_Str");
  Set<TypeMirror> types=ImmutableSet.of(typeUtil.getPrimitiveType(TypeKind.INT),typeMirrorOf("String_Node_Str"),typeUtil.getDeclaredType(list,typeMirrorOf("String_Node_Str")),typeUtil.getDeclaredType(map,typeUtil.getWildcardType(typeMirrorOf("String_Node_Str"),null),typeUtil.getWildcardType(null,typeMirrorOf("String_Node_Str"))));
  List<String> expectedImports=ImmutableList.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types,baseWithoutContainedTypes());
  assertEquals(expectedImports,ImmutableList.copyOf(typeSimplifier.typesToImport()));
}
Program: 25592
Project: 25592
Buggy source:
public void testSimplifyJavaLangNamesake(){
  TypeMirror javaLangDouble=typeMirrorOf("String_Node_Str");
  TypeMirror awtDouble=typeMirrorOf("String_Node_Str");
  Set<TypeMirror> types=ImmutableSet.of(javaLangDouble,awtDouble);
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types);
  assertEquals(javaLangDouble.toString(),typeSimplifier.simplify(javaLangDouble));
  assertEquals(awtDouble.toString(),typeSimplifier.simplify(awtDouble));
}

Fixed version (ground truth):
public void testSimplifyJavaLangNamesake(){
  TypeMirror javaLangDouble=typeMirrorOf("String_Node_Str");
  TypeMirror awtDouble=typeMirrorOf("String_Node_Str");
  Set<TypeMirror> types=ImmutableSet.of(javaLangDouble,awtDouble);
  TypeSimplifier typeSimplifier=new TypeSimplifier(typeUtil,"String_Node_Str",types,baseWithoutContainedTypes());
  assertEquals(javaLangDouble.toString(),typeSimplifier.simplify(javaLangDouble));
  assertEquals(awtDouble.toString(),typeSimplifier.simplify(awtDouble));
}
Program: 25594
Project: 25594
Buggy source:
@Override public ImmutableSet<FactoryMethodDescriptor> visitExecutableAsConstructor(ExecutableElement e,Void p){
  return super.visitExecutableAsConstructor(e,p);
}

Fixed version (ground truth):
@Override public ImmutableSet<FactoryMethodDescriptor> visitExecutableAsConstructor(ExecutableElement e,Void p){
  return ImmutableSet.of(generateDescriptorForConstructor(declaration,e));
}
Program: 25597
Project: 25597
Buggy source:
@Before public void createCompiler() throws IOException {
  this.compiler=ToolProvider.getSystemJavaCompiler();
  this.fileManager=compiler.getStandardFileManager(null,Locale.getDefault(),UTF_8);
  this.inputSources=folder.newFolder();
  this.outputSources=folder.newFolder();
  fileManager.setLocation(SOURCE_OUTPUT,ImmutableSet.of(outputSources));
}

Fixed version (ground truth):
@Before public void createCompiler() throws IOException {
  this.compiler=ToolProvider.getSystemJavaCompiler();
  this.fileManager=compiler.getStandardFileManager(null,Locale.getDefault(),UTF_8);
  this.inputSources=folder.newFolder();
  this.expectedSources=folder.newFolder();
  this.outputSources=folder.newFolder();
  fileManager.setLocation(SOURCE_OUTPUT,ImmutableSet.of(outputSources));
}
Program: 25598
Project: 25598
Buggy source:
public void put(URI uri,Headers headers){
  maybeInit();
  try {
    manager.put(uri,headers.getMultiMap());
    if (headers.get("String_Node_Str") == null)     return;
    List<HttpCookie> cookies=manager.getCookieStore().get(uri);
    Headers dump=new Headers();
    for (    HttpCookie cookie : cookies) {
      dump.add("String_Node_Str",cookie.getName() + "String_Node_Str" + cookie.getValue());
    }
    String key=uri.getScheme() + "String_Node_Str" + uri.getAuthority();
    preferences.edit().putString(key,dump.toPrefixString("String_Node_Str")).commit();
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
public void put(URI uri,Headers headers){
  maybeInit();
  try {
    manager.put(uri,headers.getMultiMap());
    if (headers.get("String_Node_Str") == null)     return;
    List<HttpCookie> cookies=manager.getCookieStore().get(uri);
    Headers dump=new Headers();
    for (    HttpCookie cookie : cookies) {
      dump.add("String_Node_Str",cookie.getName() + "String_Node_Str" + cookie.getValue()+ "String_Node_Str"+ cookie.getPath());
    }
    String key=uri.getScheme() + "String_Node_Str" + uri.getAuthority();
    preferences.edit().putString(key,dump.toPrefixString("String_Node_Str")).commit();
  }
 catch (  Exception e) {
  }
}
Program: 25599
Project: 25599
Buggy source:
@Override public void setAlpha(int alpha){
  super.setAlpha(alpha);
  paint.setAlpha(alpha);
}

Fixed version (ground truth):
@Override public void setAlpha(int alpha){
  super.setAlpha(alpha);
  this.alpha=alpha;
  paint.setAlpha(alpha);
}
Program: 25601
Project: 25601
Buggy source:
public void put(URI uri,Headers headers){
  maybeInit();
  try {
    manager.put(uri,headers.getMultiMap());
    if (headers.get("String_Node_Str") == null)     return;
    List<HttpCookie> cookies=manager.getCookieStore().get(uri);
    Headers dump=new Headers();
    for (    HttpCookie cookie : cookies) {
      dump.add("String_Node_Str",cookie.getName() + "String_Node_Str" + cookie.getValue());
    }
    String key=uri.getScheme() + "String_Node_Str" + uri.getAuthority();
    preferences.edit().putString(key,dump.toPrefixString("String_Node_Str")).commit();
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
public void put(URI uri,Headers headers){
  maybeInit();
  try {
    manager.put(uri,headers.getMultiMap());
    if (headers.get("String_Node_Str") == null)     return;
    List<HttpCookie> cookies=manager.getCookieStore().get(uri);
    Headers dump=new Headers();
    for (    HttpCookie cookie : cookies) {
      dump.add("String_Node_Str",cookie.getName() + "String_Node_Str" + cookie.getValue()+ "String_Node_Str"+ cookie.getPath());
    }
    String key=uri.getScheme() + "String_Node_Str" + uri.getAuthority();
    preferences.edit().putString(key,dump.toPrefixString("String_Node_Str")).commit();
  }
 catch (  Exception e) {
  }
}
Program: 25602
Project: 25602
Buggy source:
public GifFrame getCurrentFrame(){
  long now=System.currentTimeMillis();
  if (nextFrameRender == 0) {
    nextFrameRender=now + getDelay();
    scheduleNextFrame();
  }
  if (now >= nextFrameRender) {
    if (gifDecoder.getLastFrame() != currentFrame) {
      currentFrame=gifDecoder.getLastFrame();
      nextFrameRender+=getDelay();
    }
    scheduleNextFrame();
  }
  return currentFrame;
}

Fixed version (ground truth):
public GifFrame getCurrentFrame(){
  long now=System.currentTimeMillis();
  if (nextFrameRender == 0) {
    nextFrameRender=now + getDelay();
    scheduleNextFrame();
  }
  if (now >= nextFrameRender) {
    if (gifDecoder.getLastFrame() != currentFrame) {
      currentFrame=gifDecoder.getLastFrame();
      if (now > nextFrameRender + getDelay())       nextFrameRender=now + getDelay();
 else       nextFrameRender+=getDelay();
    }
    scheduleNextFrame();
  }
  return currentFrame;
}
Program: 25603
Project: 25603
Buggy source:
private void addCookieMiddleware(){
  httpClient.insertMiddleware(cookieMiddleware=new CookieMiddleware(context,name));
}

Fixed version (ground truth):
private void addCookieMiddleware(){
  httpClient.insertMiddleware(cookieMiddleware=new CookieMiddleware(this));
}
Program: 25604
Project: 25604
Buggy source:
@Override public void onHeadersReceived(OnHeadersReceivedDataOnRequestSentData data){
  try {
    put(URI.create(data.request.getUri().toString()),data.response.headers());
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
@Override public void onHeadersReceived(OnHeadersReceivedDataOnRequestSentData data){
  maybeInit();
  try {
    put(URI.create(data.request.getUri().toString()),data.response.headers());
  }
 catch (  Exception e) {
  }
}
Program: 25605
Project: 25605
Buggy source:
public CookieMiddleware(Context context,String name){
  reinit(context,name);
}

Fixed version (ground truth):
public CookieMiddleware(Ion ion){
  this.ion=ion;
}
Program: 25606
Project: 25606
Buggy source:
public CookieManager getCookieManager(){
  return manager;
}

Fixed version (ground truth):
public CookieManager getCookieManager(){
  maybeInit();
  return manager;
}
Program: 25607
Project: 25607
Buggy source:
@Override public void onRequest(OnRequestData data){
  try {
    Map<String,List<String>> cookies=manager.get(URI.create(data.request.getUri().toString()),data.request.getHeaders().getMultiMap());
    addCookies(cookies,data.request.getHeaders());
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
@Override public void onRequest(OnRequestData data){
  maybeInit();
  try {
    Map<String,List<String>> cookies=manager.get(URI.create(data.request.getUri().toString()),data.request.getHeaders().getMultiMap());
    addCookies(cookies,data.request.getHeaders());
  }
 catch (  Exception e) {
  }
}
Program: 25608
Project: 25608
Buggy source:
public void clear(){
  getCookieStore().removeAll();
  preferences.edit().clear().commit();
}

Fixed version (ground truth):
public void clear(){
  maybeInit();
  getCookieStore().removeAll();
  preferences.edit().clear().apply();
}
Program: 25609
Project: 25609
Buggy source:
public void reinit(Context context,String name){
  manager=new CookieManager(null,null);
  preferences=context.getSharedPreferences(name + "String_Node_Str",Context.MODE_PRIVATE);
  Map<String,?> allPrefs=preferences.getAll();
  for (  String key : allPrefs.keySet()) {
    try {
      String value=preferences.getString(key,null);
      Headers headers=new Headers();
      String[] lines=value.split("String_Node_Str");
      boolean first=true;
      for (      String line : lines) {
        if (first) {
          first=false;
        }
 else         if (!TextUtils.isEmpty(line)) {
          headers.addLine(line);
        }
      }
      manager.put(URI.create(key),headers.getMultiMap());
    }
 catch (    Exception e) {
      Log.e("String_Node_Str","String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
public void reinit(){
  manager=new CookieManager(null,null);
  preferences=ion.getContext().getSharedPreferences(ion.getName() + "String_Node_Str",Context.MODE_PRIVATE);
  Map<String,?> allPrefs=preferences.getAll();
  for (  String key : allPrefs.keySet()) {
    try {
      String value=preferences.getString(key,null);
      Headers headers=new Headers();
      String[] lines=value.split("String_Node_Str");
      boolean first=true;
      for (      String line : lines) {
        if (first) {
          first=false;
        }
 else         if (!TextUtils.isEmpty(line)) {
          headers.addLine(line);
        }
      }
      manager.put(URI.create(key),headers.getMultiMap());
    }
 catch (    Exception e) {
      Log.e("String_Node_Str","String_Node_Str",e);
    }
  }
}
Program: 25610
Project: 25610
Buggy source:
public void put(URI uri,Headers headers){
  try {
    manager.put(uri,headers.getMultiMap());
    if (headers.get("String_Node_Str") == null)     return;
    List<HttpCookie> cookies=manager.getCookieStore().get(uri);
    Headers dump=new Headers();
    for (    HttpCookie cookie : cookies) {
      dump.add("String_Node_Str",cookie.getName() + "String_Node_Str" + cookie.getValue());
    }
    String key=uri.getScheme() + "String_Node_Str" + uri.getAuthority();
    preferences.edit().putString(key,dump.toPrefixString("String_Node_Str")).commit();
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
public void put(URI uri,Headers headers){
  maybeInit();
  try {
    manager.put(uri,headers.getMultiMap());
    if (headers.get("String_Node_Str") == null)     return;
    List<HttpCookie> cookies=manager.getCookieStore().get(uri);
    Headers dump=new Headers();
    for (    HttpCookie cookie : cookies) {
      dump.add("String_Node_Str",cookie.getName() + "String_Node_Str" + cookie.getValue());
    }
    String key=uri.getScheme() + "String_Node_Str" + uri.getAuthority();
    preferences.edit().putString(key,dump.toPrefixString("String_Node_Str")).commit();
  }
 catch (  Exception e) {
  }
}
Program: 25611
Project: 25611
Buggy source:
public void testReinit() throws Exception {
  CookieMiddleware middleware=Ion.getDefault(getContext()).getCookieMiddleware();
  Ion ion=Ion.getDefault(getContext());
  ion.getCookieMiddleware().clear();
  Headers headers=new Headers();
  headers.set("String_Node_Str","String_Node_Str");
  URI uri=URI.create("String_Node_Str");
  middleware.put(uri,headers);
  headers.set("String_Node_Str","String_Node_Str");
  middleware.put(uri,headers);
  headers.set("String_Node_Str","String_Node_Str");
  middleware.put(uri,headers);
  middleware.reinit(getContext(),Ion.getDefault(getContext()).getName());
  CookieManager manager=middleware.getCookieManager();
  Headers newHeaders=new Headers();
  Map<String,List<String>> cookies=manager.get(uri,newHeaders.getMultiMap());
  manager.get(uri,cookies);
  CookieMiddleware.addCookies(cookies,newHeaders);
  assertTrue(newHeaders.get("String_Node_Str").contains("String_Node_Str"));
  assertTrue(newHeaders.get("String_Node_Str").contains("String_Node_Str"));
  assertFalse(newHeaders.get("String_Node_Str").contains("String_Node_Str"));
}

Fixed version (ground truth):
public void testReinit() throws Exception {
  CookieMiddleware middleware=Ion.getDefault(getContext()).getCookieMiddleware();
  Ion ion=Ion.getDefault(getContext());
  ion.getCookieMiddleware().clear();
  Headers headers=new Headers();
  headers.set("String_Node_Str","String_Node_Str");
  URI uri=URI.create("String_Node_Str");
  middleware.put(uri,headers);
  headers.set("String_Node_Str","String_Node_Str");
  middleware.put(uri,headers);
  headers.set("String_Node_Str","String_Node_Str");
  middleware.put(uri,headers);
  middleware.reinit();
  CookieManager manager=middleware.getCookieManager();
  Headers newHeaders=new Headers();
  Map<String,List<String>> cookies=manager.get(uri,newHeaders.getMultiMap());
  manager.get(uri,cookies);
  CookieMiddleware.addCookies(cookies,newHeaders);
  assertTrue(newHeaders.get("String_Node_Str").contains("String_Node_Str"));
  assertTrue(newHeaders.get("String_Node_Str").contains("String_Node_Str"));
  assertFalse(newHeaders.get("String_Node_Str").contains("String_Node_Str"));
}
Program: 25612
Project: 25612
Buggy source:
public void testCookie() throws Exception {
  Ion ion=Ion.getDefault(getContext());
  ion.getCookieMiddleware().clear();
  ion.build(getContext()).load("String_Node_Str").asString().get();
  for (  HttpCookie cookie : ion.getCookieMiddleware().getCookieStore().get(URI.create("String_Node_Str"))) {
    Log.i("String_Node_Str",cookie.getName() + "String_Node_Str" + cookie.getValue());
  }
  assertTrue(ion.getCookieMiddleware().getCookieManager().get(URI.create("String_Node_Str"),new Multimap()).size() > 0);
  CookieMiddleware deserialize=new CookieMiddleware(getContext(),ion.getDefault(getContext()).getName());
  assertTrue(deserialize.getCookieManager().get(URI.create("String_Node_Str"),new Multimap()).size() > 0);
}

Fixed version (ground truth):
public void testCookie() throws Exception {
  Ion ion=Ion.getDefault(getContext());
  ion.getCookieMiddleware().clear();
  ion.build(getContext()).load("String_Node_Str").asString().get();
  for (  HttpCookie cookie : ion.getCookieMiddleware().getCookieStore().get(URI.create("String_Node_Str"))) {
    Log.i("String_Node_Str",cookie.getName() + "String_Node_Str" + cookie.getValue());
  }
  assertTrue(ion.getCookieMiddleware().getCookieManager().get(URI.create("String_Node_Str"),new Multimap()).size() > 0);
  CookieMiddleware deserialize=new CookieMiddleware(ion);
  assertTrue(deserialize.getCookieManager().get(URI.create("String_Node_Str"),new Multimap()).size() > 0);
}
Program: 25614
Project: 25614
Buggy source:
private Ion(Context context,String name){
  this.context=context=context.getApplicationContext();
  this.name=name;
  httpClient=new AsyncHttpClient(new AsyncServer("String_Node_Str" + name));
  httpClient.getSSLSocketMiddleware().setHostnameVerifier(new BrowserCompatHostnameVerifier());
  httpClient.insertMiddleware(conscryptMiddleware=new ConscryptMiddleware(context,httpClient.getSSLSocketMiddleware()));
  File ionCacheDir=new File(context.getCacheDir(),name);
  try {
    responseCache=ResponseCacheMiddleware.addCache(httpClient,ionCacheDir,10L * 1024L * 1024L);
  }
 catch (  IOException e) {
    IonLog.w("String_Node_Str",e);
    FileUtility.deleteDirectory(ionCacheDir);
    try {
      responseCache=ResponseCacheMiddleware.addCache(httpClient,ionCacheDir,10L * 1024L * 1024L);
    }
 catch (    IOException ex) {
      IonLog.w("String_Node_Str",e);
    }
  }
  storeCache=new FileCache(new File(context.getFilesDir(),name),Long.MAX_VALUE,false);
  if (Build.VERSION.SDK_INT >= 9)   addCookieMiddleware();
  httpClient.getSocketMiddleware().setConnectAllAddresses(true);
  httpClient.getSSLSocketMiddleware().setConnectAllAddresses(true);
  bitmapCache=new IonBitmapCache(this);
  configure().addLoader(videoLoader=new VideoLoader()).addLoader(packageIconLoader=new PackageIconLoader()).addLoader(httpLoader=new HttpLoader()).addLoader(contentLoader=new ContentLoader()).addLoader(resourceLoader=new ResourceLoader()).addLoader(assetLoader=new AssetLoader()).addLoader(fileLoader=new FileLoader());
}

Fixed version (ground truth):
private Ion(Context context,String name){
  this.context=context=context.getApplicationContext();
  this.name=name;
  httpClient=new AsyncHttpClient(new AsyncServer("String_Node_Str" + name));
  httpClient.getSSLSocketMiddleware().setHostnameVerifier(new BrowserCompatHostnameVerifier());
  httpClient.getSSLSocketMiddleware().setSpdyEnabled(true);
  httpClient.insertMiddleware(conscryptMiddleware=new ConscryptMiddleware(context,httpClient.getSSLSocketMiddleware()));
  File ionCacheDir=new File(context.getCacheDir(),name);
  try {
    responseCache=ResponseCacheMiddleware.addCache(httpClient,ionCacheDir,10L * 1024L * 1024L);
  }
 catch (  IOException e) {
    IonLog.w("String_Node_Str",e);
    FileUtility.deleteDirectory(ionCacheDir);
    try {
      responseCache=ResponseCacheMiddleware.addCache(httpClient,ionCacheDir,10L * 1024L * 1024L);
    }
 catch (    IOException ex) {
      IonLog.w("String_Node_Str",e);
    }
  }
  storeCache=new FileCache(new File(context.getFilesDir(),name),Long.MAX_VALUE,false);
  if (Build.VERSION.SDK_INT >= 9)   addCookieMiddleware();
  httpClient.getSocketMiddleware().setConnectAllAddresses(true);
  httpClient.getSSLSocketMiddleware().setConnectAllAddresses(true);
  bitmapCache=new IonBitmapCache(this);
  configure().addLoader(videoLoader=new VideoLoader()).addLoader(packageIconLoader=new PackageIconLoader()).addLoader(httpLoader=new HttpLoader()).addLoader(contentLoader=new ContentLoader()).addLoader(resourceLoader=new ResourceLoader()).addLoader(assetLoader=new AssetLoader()).addLoader(fileLoader=new FileLoader());
}
Program: 25615
Project: 25615
Buggy source:
public void testAAIssue225() throws Exception {
  Ion.getDefault(getContext()).getConscryptMiddleware().enable(false);
  String ret=Ion.with(getContext()).load("String_Node_Str").noCache().asString().get();
  System.out.println(ret);
}

Fixed version (ground truth):
public void testAAIssue225() throws Exception {
  String ret=Ion.with(getContext()).load("String_Node_Str").noCache().asString().get();
  System.out.println(ret);
}
Program: 25616
Project: 25616
Buggy source:
@Override public ImageViewFuture intoImageView(ImageView imageView){
  return new IonImageViewRequestBuilder(this).intoImageView(imageView);
}

Fixed version (ground truth):
@Override public ImageViewFuture intoImageView(ImageView imageView){
  return new IonImageViewRequestBuilder(this).withImageView(imageView).intoImageView(imageView);
}
Program: 25617
Project: 25617
Buggy source:
@Override public ImageViewFuture intoImageView(ImageView imageView){
  return new IonImageViewRequestBuilder(this).intoImageView(imageView);
}

Fixed version (ground truth):
@Override public ImageViewFuture intoImageView(ImageView imageView){
  return new IonImageViewRequestBuilder(this).withImageView(imageView).intoImageView(imageView);
}
Program: 25619
Project: 25619
Buggy source:
public void enable(boolean enabled){
  this.enabled=enabled;
  if (!enabled) {
    instanceInitialized=false;
    middleware.setSSLContext(null);
  }
}

Fixed version (ground truth):
public void enable(boolean enabled){
  this.enabled=enabled;
  if (!enabled) {
    instanceInitialized=false;
    for (    AsyncSSLSocketMiddleware m : middleware) {
      m.setSSLContext(null);
    }
  }
}
Program: 25620
Project: 25620
Buggy source:
private void initialize(){
  initialize(context);
  if (success && !instanceInitialized && enabled) {
    instanceInitialized=true;
    try {
      SSLContext sslContext=SSLContext.getInstance("String_Node_Str");
      sslContext.init(null,null,null);
      middleware.setSSLContext(sslContext);
    }
 catch (    Exception e) {
    }
  }
}

Fixed version (ground truth):
private void initialize(){
  initialize(context);
  if (success && !instanceInitialized && enabled) {
    instanceInitialized=true;
    try {
      SSLContext sslContext=SSLContext.getInstance("String_Node_Str");
      sslContext.init(null,null,null);
      for (      AsyncSSLSocketMiddleware m : middleware) {
        m.setSSLContext(sslContext);
      }
    }
 catch (    Exception e) {
    }
  }
}
Program: 25621
Project: 25621
Buggy source:
public ConscryptMiddleware(Context context,AsyncSSLSocketMiddleware middleware){
  this.middleware=middleware;
  this.context=context.getApplicationContext();
}

Fixed version (ground truth):
public ConscryptMiddleware(Context context,AsyncSSLSocketMiddleware... middleware){
  this.middleware=middleware;
  this.context=context.getApplicationContext();
}
Program: 25622
Project: 25622
Buggy source:
@Override public Future<Bitmap> asBitmap(){
  if (builder.uri == null) {
    return FUTURE_BITMAP_NULL_URI;
  }
  BitmapFetcher bitmapFetcher=executeCache();
  if (bitmapFetcher.info != null) {
    SimpleFuture<Bitmap> ret=new SimpleFuture<Bitmap>();
    Bitmap bitmap=bitmapFetcher.info.bitmaps == null ? null : bitmapFetcher.info.bitmaps[0];
    ret.setComplete(bitmapFetcher.info.exception,bitmap);
    return ret;
  }
  bitmapFetcher.execute();
  BitmapInfoToBitmap ret=new BitmapInfoToBitmap(builder.contextReference);
  ion.bitmapsPending.add(bitmapFetcher.bitmapKey,ret);
  return ret;
}

Fixed version (ground truth):
@Override public Future<Bitmap> asBitmap(){
  if (builder.uri == null) {
    return FUTURE_BITMAP_NULL_URI;
  }
  final BitmapFetcher bitmapFetcher=executeCache();
  if (bitmapFetcher.info != null) {
    SimpleFuture<Bitmap> ret=new SimpleFuture<Bitmap>();
    Bitmap bitmap=bitmapFetcher.info.bitmaps == null ? null : bitmapFetcher.info.bitmaps[0];
    ret.setComplete(bitmapFetcher.info.exception,bitmap);
    return ret;
  }
  final BitmapInfoToBitmap ret=new BitmapInfoToBitmap(builder.contextReference);
  AsyncServer.post(Ion.mainHandler,new Runnable(){
    @Override public void run(){
      bitmapFetcher.execute();
      ion.bitmapsPending.add(bitmapFetcher.bitmapKey,ret);
    }
  }
);
  return ret;
}
Program: 25623
Project: 25623
Buggy source:
@Override public Future<Bitmap> asBitmap(){
  if (builder.uri == null) {
    return FUTURE_BITMAP_NULL_URI;
  }
  BitmapFetcher bitmapFetcher=executeCache();
  if (bitmapFetcher.info != null) {
    SimpleFuture<Bitmap> ret=new SimpleFuture<Bitmap>();
    Bitmap bitmap=bitmapFetcher.info.bitmaps == null ? null : bitmapFetcher.info.bitmaps[0];
    ret.setComplete(bitmapFetcher.info.exception,bitmap);
    return ret;
  }
  bitmapFetcher.execute();
  BitmapInfoToBitmap ret=new BitmapInfoToBitmap(builder.contextReference);
  ion.bitmapsPending.add(bitmapFetcher.bitmapKey,ret);
  return ret;
}

Fixed version (ground truth):
@Override public Future<Bitmap> asBitmap(){
  if (builder.uri == null) {
    return FUTURE_BITMAP_NULL_URI;
  }
  final BitmapFetcher bitmapFetcher=executeCache();
  if (bitmapFetcher.info != null) {
    SimpleFuture<Bitmap> ret=new SimpleFuture<Bitmap>();
    Bitmap bitmap=bitmapFetcher.info.bitmaps == null ? null : bitmapFetcher.info.bitmaps[0];
    ret.setComplete(bitmapFetcher.info.exception,bitmap);
    return ret;
  }
  final BitmapInfoToBitmap ret=new BitmapInfoToBitmap(builder.contextReference);
  AsyncServer.post(Ion.mainHandler,new Runnable(){
    @Override public void run(){
      bitmapFetcher.execute();
      ion.bitmapsPending.add(bitmapFetcher.bitmapKey,ret);
    }
  }
);
  return ret;
}
Program: 25624
Project: 25624
Buggy source:
public IonDrawable setBitmap(BitmapInfo info,int loadedFrom){
  this.loadedFrom=loadedFrom;
  if (this.info == info)   return this;
  invalidateSelf();
  this.info=info;
  currentFrame=0;
  invalidateScheduled=false;
  if (info == null) {
    callback.bitmapKey=null;
    return this;
  }
  if (info.decoder != null) {
    double wlevel=(double)info.originalSize.x / TILE_DIM;
    double hlevel=(double)info.originalSize.y / TILE_DIM;
    double level=Math.max(wlevel,hlevel);
    level=Math.log(level) / LOG_2;
    maxLevel=(int)Math.ceil(level);
    textureDim=TILE_DIM << maxLevel;
  }
  callback.bitmapKey=info.key;
  return this;
}

Fixed version (ground truth):
public IonDrawable setBitmap(BitmapInfo info,int loadedFrom){
  if (this.info == info)   return this;
  cancel();
  this.loadedFrom=loadedFrom;
  this.info=info;
  currentFrame=0;
  invalidateScheduled=false;
  invalidateSelf();
  if (info == null) {
    callback.bitmapKey=null;
    return this;
  }
  if (info.decoder != null) {
    double wlevel=(double)info.originalSize.x / TILE_DIM;
    double hlevel=(double)info.originalSize.y / TILE_DIM;
    double level=Math.max(wlevel,hlevel);
    level=Math.log(level) / LOG_2;
    maxLevel=(int)Math.ceil(level);
    textureDim=TILE_DIM << maxLevel;
  }
  callback.bitmapKey=info.key;
  return this;
}
Program: 25625
Project: 25625
Buggy source:
private void drawDrawable(Canvas canvas,Drawable d){
  int iw=d.getIntrinsicWidth();
  int ih=d.getIntrinsicHeight();
  int w=getIntrinsicWidth();
  int h=getIntrinsicHeight();
  int wp=(w - iw) / 2;
  int hp=(h - ih) / 2;
  Rect b=copyBounds();
  b.left+=wp;
  b.right=b.left + iw;
  b.top+=hp;
  b.bottom=b.top + ih;
  d.setBounds(b);
  d.draw(canvas);
}

Fixed version (ground truth):
private void drawDrawable(Canvas canvas,Drawable d){
  int iw=d.getIntrinsicWidth();
  int ih=d.getIntrinsicHeight();
  Rect b=copyBounds();
  int w=b.width();
  int h=b.height();
  if (iw >= 0) {
    int wp=(w - iw) / 2;
    b.left+=wp;
    b.right=b.left + iw;
  }
  if (ih >= 0) {
    int hp=(h - ih) / 2;
    b.top+=hp;
    b.bottom=b.top + ih;
  }
  d.setBounds(b);
  d.draw(canvas);
}
Program: 25626
Project: 25626
Buggy source:
@Override public Builders.Any.B setHeader(NameValuePair... header){
  for (  NameValuePair h : header) {
    this.headers.set(h.getName(),h.getValue());
  }
  return this;
}

Fixed version (ground truth):
@Override public Builders.Any.B setHeader(NameValuePair... header){
  RawHeaders headers=getHeaders();
  for (  NameValuePair h : header) {
    headers.set(h.getName(),h.getValue());
  }
  return this;
}
Program: 25627
Project: 25627
Buggy source:
@Override public Future<Response<T>> withResponse(){
  final SimpleFuture<Response<T>> ret=new SimpleFuture<Response<T>>();
  setCallback(new FutureCallback<T>(){
    @Override public void onCompleted(    Exception e,    T result){
      if (emitter != null) {
        Response<T> response=new Response<T>();
        response.headers=headers;
        response.request=finalRequest;
        response.result=result;
        response.exception=e;
        ret.setComplete(response);
        return;
      }
      ret.setComplete(e,null);
    }
  }
);
  return ret;
}

Fixed version (ground truth):
@Override public Future<Response<T>> withResponse(){
  final SimpleFuture<Response<T>> ret=new SimpleFuture<Response<T>>();
  setCallback(new FutureCallback<T>(){
    @Override public void onCompleted(    Exception e,    T result){
      if (emitter != null) {
        Response<T> response=new Response<T>();
        response.headers=headers;
        response.request=finalRequest;
        response.result=result;
        response.exception=e;
        ret.setComplete(response);
        return;
      }
      ret.setComplete(e,null);
    }
  }
);
  ret.setParent(this);
  return ret;
}
Program: 25628
Project: 25628
Buggy source:
@Override public void write(DataSink sink,T pojo,CompletedCallback completed){
  ByteArrayOutputStream bout=new ByteArrayOutputStream();
  OutputStreamWriter out=new OutputStreamWriter(bout);
  gson.toJson(pojo,type,out);
  Util.writeAll(sink,bout.toByteArray(),completed);
}

Fixed version (ground truth):
@Override public void write(DataSink sink,T pojo,CompletedCallback completed){
  ByteArrayOutputStream bout=new ByteArrayOutputStream();
  OutputStreamWriter out=new OutputStreamWriter(bout);
  gson.toJson(pojo,type,out);
  try {
    out.flush();
  }
 catch (  final Exception e) {
    throw new AssertionError(e);
  }
  Util.writeAll(sink,bout.toByteArray(),completed);
}
Program: 25629
Project: 25629
Buggy source:
@Override public Future<Response<T>> withResponse(){
  final SimpleFuture<Response<T>> ret=new SimpleFuture<Response<T>>();
  setCallback(new FutureCallback<T>(){
    @Override public void onCompleted(    Exception e,    T result){
      if (emitter != null) {
        Response<T> response=new Response<T>();
        response.headers=headers;
        response.request=finalRequest;
        response.result=result;
        response.exception=e;
        ret.setComplete(response);
        return;
      }
      ret.setComplete(e,null);
    }
  }
);
  return ret;
}

Fixed version (ground truth):
@Override public Future<Response<T>> withResponse(){
  final SimpleFuture<Response<T>> ret=new SimpleFuture<Response<T>>();
  setCallback(new FutureCallback<T>(){
    @Override public void onCompleted(    Exception e,    T result){
      if (emitter != null) {
        Response<T> response=new Response<T>();
        response.headers=headers;
        response.request=finalRequest;
        response.result=result;
        response.exception=e;
        ret.setComplete(e,response);
        return;
      }
      ret.setComplete(e,null);
    }
  }
);
  return ret;
}
Program: 25630
Project: 25630
Buggy source:
@Override public Bitmap transform(Bitmap b){
  Bitmap ret=Bitmap.createBitmap(resizeWidth,resizeHeight,b.getConfig());
  Canvas canvas=new Canvas(ret);
  RectF destination=new RectF(0,0,resizeWidth,resizeHeight);
  if (scaleMode != ScaleMode.FitXY) {
    float ratio;
    float xratio=(float)resizeWidth / (float)b.getWidth();
    float yratio=(float)resizeHeight / (float)b.getHeight();
    if (scaleMode == ScaleMode.CenterCrop)     ratio=Math.max(xratio,yratio);
 else     ratio=Math.min(xratio,yratio);
    float postx=b.getWidth() * ratio;
    float posty=b.getHeight() * ratio;
    float transx=(resizeWidth - postx) / 2;
    float transy=(resizeHeight - posty) / 2;
    destination.set(transx,transy,postx,posty);
  }
  canvas.drawBitmap(b,null,destination,null);
  return ret;
}

Fixed version (ground truth):
@Override public Bitmap transform(Bitmap b){
  Bitmap ret=Bitmap.createBitmap(resizeWidth,resizeHeight,b.getConfig());
  Canvas canvas=new Canvas(ret);
  RectF destination=new RectF(0,0,resizeWidth,resizeHeight);
  if (scaleMode != ScaleMode.FitXY) {
    float ratio;
    float xratio=(float)resizeWidth / (float)b.getWidth();
    float yratio=(float)resizeHeight / (float)b.getHeight();
    if (scaleMode == ScaleMode.CenterCrop)     ratio=Math.max(xratio,yratio);
 else     ratio=Math.min(xratio,yratio);
    float postWidth=b.getWidth() * ratio;
    float postHeight=b.getHeight() * ratio;
    float transx=(resizeWidth - postWidth) / 2;
    float transy=(resizeHeight - postHeight) / 2;
    destination.set(transx,transy,transx + postWidth,transy + postHeight);
  }
  canvas.drawBitmap(b,null,destination,null);
  return ret;
}
Program: 25631
Project: 25631
Buggy source:
@Override public void run(){
  invalidateScheduled=false;
  invalidateSelf();
}

Fixed version (ground truth):
@Override public void run(){
  invalidateScheduled=false;
  currentFrame++;
  invalidateSelf();
}
Program: 25633
Project: 25633
Buggy source:
/** 
 * Called when the activity is first created.
 */
@Override public void onCreate(Bundle savedInstanceState){
  StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());
  super.onCreate(savedInstanceState);
  Ion.getDefault(this).setLogging("String_Node_Str",Log.DEBUG);
  setContentView(R.layout.google_image_search);
  final Button search=(Button)findViewById(R.id.search);
  searchText=(EditText)findViewById(R.id.search_text);
  mListView=(ListView)findViewById(R.id.results);
  mAdapter=new MyAdapter(this);
  MyGridAdapter a=new MyGridAdapter(mAdapter);
  mListView.setAdapter(a);
  search.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mAdapter.clear();
      loadMore();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created.
 */
@Override public void onCreate(Bundle savedInstanceState){
  StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());
  super.onCreate(savedInstanceState);
  Ion.getDefault(this).setLogging("String_Node_Str",Log.DEBUG);
  setContentView(R.layout.google_image_search);
  final Button search=(Button)findViewById(R.id.search);
  searchText=(EditText)findViewById(R.id.search_text);
  search.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mAdapter.clear();
      loadMore();
      InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
      imm.hideSoftInputFromWindow(searchText.getWindowToken(),0);
    }
  }
);
  mListView=(ListView)findViewById(R.id.results);
  mAdapter=new MyAdapter(this);
  MyGridAdapter a=new MyGridAdapter(mAdapter);
  mListView.setAdapter(a);
}
Program: 25634
Project: 25634
Buggy source:
@Override public void onClick(View v){
  mAdapter.clear();
  loadMore();
}

Fixed version (ground truth):
@Override public void onClick(View v){
  mAdapter.clear();
  loadMore();
  InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(searchText.getWindowToken(),0);
}
Program: 25635
Project: 25635
Buggy source:
public void dump(){
  Log.i(LOGTAG,"String_Node_Str" + inFlight.size());
  for (  FutureSet futures : inFlight.values()) {
    Log.i(LOGTAG,"String_Node_Str" + futures.size());
    for (    Future future : futures.keySet()) {
      Log.i(LOGTAG,"String_Node_Str" + (future.isDone() || future.isCancelled()));
    }
  }
  httpClient.getServer().dump();
}

Fixed version (ground truth):
public void dump(){
  bitmapCache.dump();
  Log.i(LOGTAG,"String_Node_Str" + pendingDownloads.size());
  Log.i(LOGTAG,"String_Node_Str" + pendingTransforms.size());
  Log.i(LOGTAG,"String_Node_Str" + pendingViews.size());
  Log.i(LOGTAG,"String_Node_Str" + inFlight.size());
  for (  FutureSet futures : inFlight.values()) {
    Log.i(LOGTAG,"String_Node_Str" + futures.size());
  }
}
Program: 25636
Project: 25636
Buggy source:
public BitmapToBitmap(Ion ion,Handler handler,String transformKey,ArrayList<Transform> transforms,ExecutorService executorService){
  this.executorService=executorService;
  this.handler=handler;
  this.transformKey=transformKey;
  this.transforms=transforms;
  this.ion=ion;
}

Fixed version (ground truth):
public BitmapToBitmap(Ion ion,Handler handler,String transformKey,ArrayList<Transform> transforms){
  this.handler=handler;
  this.transformKey=transformKey;
  this.transforms=transforms;
  this.ion=ion;
}
Program: 25637
Project: 25637
Buggy source:
public ByteArrayToBitmapFuture(Ion ion,Handler handler,String urlKey,ExecutorService executorService){
  this.executorService=executorService;
  this.handler=handler;
  this.urlKey=urlKey;
  this.ion=ion;
}

Fixed version (ground truth):
public ByteArrayToBitmapFuture(Ion ion,Handler handler,String urlKey){
  this.handler=handler;
  this.urlKey=urlKey;
  this.ion=ion;
}
Program: 25638
Project: 25638
Buggy source:
public int size(){
  int size=0;
  for (  K k : mTable.keySet()) {
    WeakReference<V> v=mTable.get(k);
    if (v != null && v.get() != null) {
      size++;
    }
  }
  return size;
}

Fixed version (ground truth):
public int size(){
  return mTable.size();
}