nus-yam/ex-repair huggingface dataset:
Program: 104909
Project: 104909
Buggy source:
/** 
 * converts an entity to a DBObject 
 */
public DBObject toDBObject(Object entity){
  BasicDBObject dbObject=new BasicDBObject();
  MappedClass mc=getMappedClass(entity);
  dbObject.put(CLASS_NAME_FIELDNAME,entity.getClass().getCanonicalName());
  dbObject=(BasicDBObject)mc.callLifecycleMethods(PrePersist.class,entity,dbObject,this);
  for (  MappedField mf : mc.getPersistenceFields()) {
    try {
      if (mf.hasAnnotation(Id.class)) {
        Object dbVal=mf.getFieldValue(entity);
        if (dbVal != null) {
          dbObject.put(ID_KEY,objectToValue(asObjectIdMaybe(dbVal)));
        }
      }
 else       if (mf.hasAnnotation(Reference.class)) {
        mapReferencesToDBObject(entity,mf,dbObject);
      }
 else       if (mf.hasAnnotation(Embedded.class) && !mf.isTypeMongoCompatible()) {
        mapEmbeddedToDBObject(entity,mf,dbObject);
      }
 else       if (mf.hasAnnotation(Property.class) || mf.hasAnnotation(Serialized.class) || mf.isTypeMongoCompatible()) {
        mapValuesToDBObject(entity,mf,dbObject);
      }
 else {
        logger.warning("String_Node_Str" + mf.getFullName() + "String_Node_Str"+ mf.getType().getSimpleName()+ "String_Node_Str");
      }
    }
 catch (    Exception e) {
      throw new MappingException("String_Node_Str" + mf.getFullName(),e);
    }
  }
  mc.callLifecycleMethods(PreSave.class,entity,dbObject,this);
  return dbObject;
}

Fixed version (ground truth):
/** 
 * converts an entity to a DBObject
 */
public DBObject toDBObject(Object entity,LinkedHashMap<Object,DBObject> involvedObjects){
  BasicDBObject dbObject=new BasicDBObject();
  MappedClass mc=getMappedClass(entity);
  dbObject.put(CLASS_NAME_FIELDNAME,entity.getClass().getCanonicalName());
  dbObject=(BasicDBObject)mc.callLifecycleMethods(PrePersist.class,entity,dbObject,this);
  for (  MappedField mf : mc.getPersistenceFields()) {
    try {
      if (mf.hasAnnotation(Id.class)) {
        Object dbVal=mf.getFieldValue(entity);
        if (dbVal != null) {
          dbObject.put(ID_KEY,objectToValue(asObjectIdMaybe(dbVal)));
        }
      }
 else       if (mf.hasAnnotation(Reference.class)) {
        mapReferencesToDBObject(entity,mf,dbObject);
      }
 else       if (mf.hasAnnotation(Embedded.class) && !mf.isTypeMongoCompatible()) {
        mapEmbeddedToDBObject(entity,mf,dbObject,involvedObjects);
      }
 else       if (mf.hasAnnotation(Property.class) || mf.hasAnnotation(Serialized.class) || mf.isTypeMongoCompatible()) {
        mapValuesToDBObject(entity,mf,dbObject);
      }
 else {
        logger.warning("String_Node_Str" + mf.getFullName() + "String_Node_Str"+ mf.getType().getSimpleName()+ "String_Node_Str");
      }
    }
 catch (    Exception e) {
      throw new MappingException("String_Node_Str" + mf.getFullName(),e);
    }
  }
  if (involvedObjects != null)   involvedObjects.put(entity,dbObject);
  mc.callLifecycleMethods(PreSave.class,entity,dbObject,this);
  return dbObject;
}
Program: 104911
Project: 104911
Buggy source:
public void save(T entity){
  DBObject dbObj=morphia.getMapper().toDBObject(entity);
  morphia.getMapper().getMappedClass(entity).callLifecycleMethods(PreSave.class,entity,dbObj,morphia.getMapper());
  collection().save(dbObj);
  DBObject lastErr=collection().getDB().getLastError();
  if (lastErr.get("String_Node_Str") != null)   throw new MappingException("String_Node_Str" + lastErr.toString());
  morphia.getMapper().updateKeyInfo(entity,dbObj.get(Mapper.ID_KEY),collectionName);
  morphia.getMapper().getMappedClass(entity).callLifecycleMethods(PostPersist.class,entity,dbObj,morphia.getMapper());
}

Fixed version (ground truth):
public void save(T entity){
  DBObject dbObj=morphia.getMapper().toDBObject(entity);
  collection().save(dbObj);
  DBObject lastErr=collection().getDB().getLastError();
  if (lastErr.get("String_Node_Str") != null)   throw new MappingException("String_Node_Str" + lastErr.toString());
  morphia.getMapper().updateKeyInfo(entity,dbObj.get(Mapper.ID_KEY),collectionName);
  morphia.getMapper().getMappedClass(entity).callLifecycleMethods(PostPersist.class,entity,dbObj,morphia.getMapper());
}
Program: 104912
Project: 104912
Buggy source:
Object fromDBObject(Class entityClass,BasicDBObject dbObject){
  entityCache.set(new HashMap<String,Object>());
  Object entity=createEntityInstanceForDbObject(entityClass,dbObject);
  mapDBObjectToEntity(dbObject,entity);
  entityCache.remove();
  return entity;
}

Fixed version (ground truth):
Object fromDBObject(Class entityClass,BasicDBObject dbObject){
  if (dbObject == null) {
    Throwable t=new Throwable();
    logger.log(Level.SEVERE,"String_Node_Str",t);
    return null;
  }
  entityCache.set(new HashMap<String,Object>());
  Object entity=createEntityInstanceForDbObject(entityClass,dbObject);
  mapDBObjectToEntity(dbObject,entity);
  entityCache.remove();
  return entity;
}
Program: 104913
Project: 104913
Buggy source:
void updateKeyInfo(Object entity,DBObject dbObj){
  MappedClass mc=getMappedClass(entity);
  if (mc.idField != null) {
    try {
      Object value=mc.idField.get(entity);
      Object dbId=dbObj.get(Mapper.ID_KEY);
      if (value != null) {
        if (!value.equals(dbId))         throw new RuntimeException("String_Node_Str" + value + "String_Node_Str"+ dbId+ "String_Node_Str"+ entity.getClass().getSimpleName());
      }
 else {
        if (dbId instanceof ObjectId && mc.idField.getType().isAssignableFrom(String.class)) {
          dbId=dbId.toString();
        }
        mc.idField.set(entity,dbId);
      }
    }
 catch (    Exception e) {
      if (e.getClass().equals(RuntimeException.class))       throw (RuntimeException)e;
      throw new RuntimeException(e);
    }
  }
  if (mc.collectionNameField != null) {
    try {
      String value=(String)mc.collectionNameField.get(entity);
      String dbNs=dbObj.get("String_Node_Str").toString();
      if (value != null && value.length() > 0) {
        if (value != null && !value.equals(dbNs))         throw new RuntimeException("String_Node_Str" + value + "String_Node_Str"+ dbNs+ "String_Node_Str"+ entity.getClass().getSimpleName());
      }
 else       if (value == null)       mc.collectionNameField.set(entity,dbNs);
    }
 catch (    Exception e) {
      throw new RuntimeException(e);
    }
  }
}

Fixed version (ground truth):
void updateKeyInfo(Object entity,DBObject dbObj){
  MappedClass mc=getMappedClass(entity);
  if (mc.idField != null) {
    try {
      Object value=mc.idField.get(entity);
      Object dbId=dbObj.get(Mapper.ID_KEY);
      if (value != null) {
        if (!dbId.equals(value))         throw new RuntimeException("String_Node_Str" + value + "String_Node_Str"+ dbId+ "String_Node_Str"+ entity.getClass().getSimpleName());
      }
 else {
        if (dbId instanceof ObjectId && mc.idField.getType().isAssignableFrom(String.class)) {
          dbId=dbId.toString();
        }
        mc.idField.set(entity,dbId);
      }
    }
 catch (    Exception e) {
      if (e.getClass().equals(RuntimeException.class))       throw (RuntimeException)e;
      throw new RuntimeException(e);
    }
  }
  if (mc.collectionNameField != null) {
    try {
      String value=(String)mc.collectionNameField.get(entity);
      String dbNs=dbObj.get("String_Node_Str").toString();
      if (value != null && value.length() > 0) {
        if (value != null && !value.equals(dbNs))         throw new RuntimeException("String_Node_Str" + value + "String_Node_Str"+ dbNs+ "String_Node_Str"+ entity.getClass().getSimpleName());
      }
 else       if (value == null)       mc.collectionNameField.set(entity,dbNs);
    }
 catch (    Exception e) {
      throw new RuntimeException(e);
    }
  }
}
Program: 104914
Project: 104914
Buggy source:
/** 
 * Returns the (first) instance of the annotation, on the class (or any superclass, or interfaces implemented).
 */
protected static <T>T getAnnotation(Class c,Class<T> ann){
  if (c.isAnnotationPresent(ann)) {
    return (T)c.getAnnotation(ann);
  }
 else {
    Class parent=c.getSuperclass();
    while (parent != null && parent != Object.class) {
      if (parent.isAnnotationPresent(ann)) {
        return (T)parent.getAnnotation(ann);
      }
      for (      Class interfaceClass : parent.getInterfaces()) {
        if (interfaceClass.isAnnotationPresent(ann)) {
          return (T)interfaceClass.getAnnotation(ann);
        }
      }
      parent=parent.getSuperclass();
    }
    for (    Class interfaceClass : c.getInterfaces()) {
      if (interfaceClass.isAnnotationPresent(ann)) {
        return (T)interfaceClass.getAnnotation(ann);
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the (first) instance of the annotation, on the class (or any superclass, or interfaces implemented).
 */
public static <T>T getAnnotation(Class c,Class<T> ann){
  if (c.isAnnotationPresent(ann)) {
    return (T)c.getAnnotation(ann);
  }
 else {
    Class parent=c.getSuperclass();
    while (parent != null && parent != Object.class) {
      if (parent.isAnnotationPresent(ann)) {
        return (T)parent.getAnnotation(ann);
      }
      for (      Class interfaceClass : parent.getInterfaces()) {
        if (interfaceClass.isAnnotationPresent(ann)) {
          return (T)interfaceClass.getAnnotation(ann);
        }
      }
      parent=parent.getSuperclass();
    }
    for (    Class interfaceClass : c.getInterfaces()) {
      if (interfaceClass.isAnnotationPresent(ann)) {
        return (T)interfaceClass.getAnnotation(ann);
      }
    }
  }
  return null;
}
Program: 104916
Project: 104916
Buggy source:
DBObject toDBObject(Object entity) throws Exception {
  BasicDBObject dbObject=new BasicDBObject();
  dbObject.put(CLASS_NAME_KEY,entity.getClass().getCanonicalName());
  String collName=getCollectionName(entity);
  if (collName != null && collName.length() > 0)   dbObject.put(COLLECTION_NAME_KEY,collName);
  MappedClass mc=getMappedClass(entity);
  if (mc == null)   mc=new MappedClass(entity.getClass());
  for (  MappedField mf : mc.persistenceFields) {
    Field field=mf.field;
    Class fieldType=field.getType();
    field.setAccessible(true);
    if (mf.hasAnnotation(Id.class)) {
      Object value=field.get(entity);
      if (value != null) {
        dbObject.put(ID_KEY,fixupId(value));
      }
    }
 else     if (mf.hasAnnotation(Reference.class)) {
      mapReferencesToDBObject(entity,mf,dbObject);
    }
 else     if (mf.hasAnnotation(Embedded.class)) {
      mapEmbeddedToDBObject(entity,mf,dbObject);
    }
 else     if (mf.hasAnnotation(Property.class) || ReflectionUtils.isPropertyType(field.getType()) || ReflectionUtils.implementsAnyInterface(fieldType,Map.class,List.class,Set.class)) {
      mapValuesToDBObject(entity,mf,dbObject);
    }
 else {
      logger.warning("String_Node_Str" + field.getName() + "String_Node_Str"+ field.getType().getSimpleName()+ "String_Node_Str");
    }
  }
  return dbObject;
}

Fixed version (ground truth):
DBObject toDBObject(Object entity) throws Exception {
  BasicDBObject dbObject=new BasicDBObject();
  dbObject.put(CLASS_NAME_KEY,entity.getClass().getCanonicalName());
  MappedClass mc=getMappedClass(entity);
  if (mc == null)   mc=new MappedClass(entity.getClass());
  String collName=(mc.collectionNameField == null) ? null : (String)mc.collectionNameField.get(entity);
  if (collName != null && collName.length() > 0)   dbObject.put(COLLECTION_NAME_KEY,collName);
  for (  MappedField mf : mc.persistenceFields) {
    Field field=mf.field;
    Class fieldType=field.getType();
    field.setAccessible(true);
    if (mf.hasAnnotation(Id.class)) {
      Object value=field.get(entity);
      if (value != null) {
        dbObject.put(ID_KEY,fixupId(value));
      }
    }
 else     if (mf.hasAnnotation(Reference.class)) {
      mapReferencesToDBObject(entity,mf,dbObject);
    }
 else     if (mf.hasAnnotation(Embedded.class)) {
      mapEmbeddedToDBObject(entity,mf,dbObject);
    }
 else     if (mf.hasAnnotation(Property.class) || ReflectionUtils.isPropertyType(field.getType()) || ReflectionUtils.implementsAnyInterface(fieldType,Map.class,List.class,Set.class)) {
      mapValuesToDBObject(entity,mf,dbObject);
    }
 else {
      logger.warning("String_Node_Str" + field.getName() + "String_Node_Str"+ field.getType().getSimpleName()+ "String_Node_Str");
    }
  }
  return dbObject;
}
Program: 104917
Project: 104917
Buggy source:
@Override public T save(T entity){
  BasicDBObject obj=(BasicDBObject)morphia.toDBObject(entity);
  collection().save(obj);
  return get(obj.get("String_Node_Str").toString());
}

Fixed version (ground truth):
@Override public T save(T entity){
  BasicDBObject obj=(BasicDBObject)morphia.toDBObject(entity);
  obj.put(Mapper.COLLECTION_NAME_KEY,collection().getName());
  collection().save(obj);
  return get(obj.get("String_Node_Str").toString());
}
Program: 104918
Project: 104918
Buggy source:
@Test public void testCollectionNames() throws Exception {
  assertTrue("String_Node_Str".equals(morphia.getMapper().getCollectionName(FacebookUser.class)));
}

Fixed version (ground truth):
@Test public void testCollectionNames() throws Exception {
  assertEquals("String_Node_Str",morphia.getMapper().getCollectionName(FacebookUser.class));
}
Program: 104919
Project: 104919
Buggy source:
@Override public WebResourceResponse shouldInterceptRequest(WebView view,WebResourceRequest resourceRequest){
  if (!mTrackingProtectionEnabled && !mAdblockEnabled && !mHttpsEverywhereEnabled) {
    return null;
  }
  String filterOption="String_Node_Str";
  Map<String,String> requestHeaders=resourceRequest.getRequestHeaders();
  for (  Map.Entry<String,String> entry : requestHeaders.entrySet()) {
    if (entry.getKey().equals("String_Node_Str")) {
      if (entry.getValue().contains("String_Node_Str")) {
        filterOption="String_Node_Str";
        break;
      }
 else       if (entry.getValue().contains("String_Node_Str")) {
        filterOption="String_Node_Str";
        break;
      }
 else       if (entry.getValue().contains("String_Node_Str")) {
        filterOption="String_Node_Str";
        break;
      }
    }
  }
  return interceptTheCall(view,resourceRequest.getUrl().toString(),filterOption,true);
}

Fixed version (ground truth):
@Override public WebResourceResponse shouldInterceptRequest(WebView view,WebResourceRequest resourceRequest){
  String currentUrl=resourceRequest.getUrl().toString();
  if (!mTrackingProtectionEnabled && !mAdblockEnabled && !mHttpsEverywhereEnabled || mUrl.toString().equals(currentUrl)) {
    return null;
  }
  String filterOption="String_Node_Str";
  Map<String,String> requestHeaders=resourceRequest.getRequestHeaders();
  for (  Map.Entry<String,String> entry : requestHeaders.entrySet()) {
    if (entry.getKey().equals("String_Node_Str")) {
      if (entry.getValue().contains("String_Node_Str")) {
        filterOption="String_Node_Str";
        break;
      }
 else       if (entry.getValue().contains("String_Node_Str")) {
        filterOption="String_Node_Str";
        break;
      }
 else       if (entry.getValue().contains("String_Node_Str")) {
        filterOption="String_Node_Str";
        break;
      }
    }
  }
  return interceptTheCall(view,currentUrl,filterOption,true);
}
Program: 104920
Project: 104920
Buggy source:
public void show(){
  int duration=667;
  if (mView.getVisibility() != View.VISIBLE) {
    duration=500;
    mView.animate().cancel();
    mView.setAlpha(0f);
    mView.setVisibility(View.VISIBLE);
    mView.setScaleX(0.33f);
    mView.setScaleY(0.33f);
  }
 else   if (mAnimState == AnimState.Hiding) {
    mView.animate().cancel();
    mView.setVisibility(View.VISIBLE);
  }
  mView.animate().alpha(mAlpha).scaleX(1f).scaleY(1f).setDuration(duration).setInterpolator(new AnticipateOvershootInterpolator()).setListener(mShowListener);
}

Fixed version (ground truth):
public void show(){
  int duration=667;
  if (mView.getVisibility() != View.VISIBLE) {
    duration=500;
    mView.animate().cancel();
    mView.setAlpha(0f);
    mView.setScaleX(0.33f);
    mView.setScaleY(0.33f);
  }
 else   if (mAnimState == AnimState.Hiding) {
    mView.animate().cancel();
  }
  mView.setVisibility(View.VISIBLE);
  mView.animate().alpha(mAlpha).scaleX(1f).scaleY(1f).setDuration(duration).setInterpolator(new AnticipateOvershootInterpolator()).setListener(mShowListener);
}
Program: 104921
Project: 104921
Buggy source:
public void doUpdateVisitedHistory(String url,boolean isReload);

Fixed version (ground truth):
public void doUpdateVisitedHistory(String url,boolean isReload,boolean unknownClick);
Program: 104922
Project: 104922
Buggy source:
@Override public void doUpdateVisitedHistory(WebView view,String url,boolean isReload){
  mController.doUpdateVisitedHistory(url,isReload);
}

Fixed version (ground truth):
@Override public void doUpdateVisitedHistory(WebView view,String url,boolean isReload){
  String extraRes=mWebView.getHitTestResult().getExtra();
  if (null == extraRes || (null != extraRes && url.equals(extraRes))) {
    mController.doUpdateVisitedHistory(url,isReload,mWebView.getHitTestResult().getType() == WebView.HitTestResult.UNKNOWN_TYPE);
  }
}
Program: 104924
Project: 104924
Buggy source:
public void collapseBubbleFlow(long time){
  try {
    FrameLayout.LayoutParams currentParams=(FrameLayout.LayoutParams)mBubbleFlowDraggable.getChildAt(0).getLayoutParams();
    currentParams.topMargin=mOriginalBubbleFlowDraggableLayoutTopMargin;
    TabView currentTabView=getCurrentTab();
    if (null != currentTabView) {
      if (currentTabView.adjustBubblesPanel(0,true,false)) {
        mBubbleFlowDraggable.getChildAt(0).setLayoutParams(currentParams);
      }
    }
    mBubbleFlowDraggable.setVisibility(View.VISIBLE);
  }
 catch (  NullPointerException exc) {
  }
  mBubbleFlowDraggable.collapse(time,mOnBubbleFlowCollapseFinishedListener);
}

Fixed version (ground truth):
public void collapseBubbleFlow(long time){
  try {
    FrameLayout.LayoutParams currentParams=(FrameLayout.LayoutParams)mBubbleFlowDraggable.getChildAt(0).getLayoutParams();
    currentParams.topMargin=mOriginalBubbleFlowDraggableLayoutTopMargin;
    TabView currentTabView=getCurrentTab();
    if (null != currentTabView) {
      if (currentTabView.adjustBubblesPanel(0,true,false)) {
        mBubbleFlowDraggable.getChildAt(0).setLayoutParams(currentParams);
      }
    }
    if (mBubbleFlowDraggable.isExpanded()) {
      mBubbleFlowDraggable.setVisibility(View.VISIBLE);
    }
  }
 catch (  NullPointerException exc) {
  }
  mBubbleFlowDraggable.collapse(time,mOnBubbleFlowCollapseFinishedListener);
}
Program: 104925
Project: 104925
Buggy source:
boolean isExpanded(){
  return mIsExpanded;
}

Fixed version (ground truth):
public boolean isExpanded(){
  return mIsExpanded;
}
Program: 104926
Project: 104926
Buggy source:
void setTabAsActive(){
  if (mUrlTextView.getText().toString().equals(getContext().getString(R.string.empty_bubble_page))) {
    mTitleTextView.performClick();
  }
}

Fixed version (ground truth):
void setTabAsActive(){
  if (mUrlTextView.getText().toString().equals(getContext().getString(R.string.empty_bubble_page))) {
    mTitleTextView.performClick();
  }
 else {
    mWebRenderer.getView().requestFocus();
  }
}
Program: 104931
Project: 104931
Buggy source:
void setPreferenceIcon(Preference preference,Drawable drawable){
  if (drawable instanceof BitmapDrawable) {
    Bitmap bitmap=((BitmapDrawable)drawable).getBitmap();
    ActivityManager activityManager=(ActivityManager)getActivity().getSystemService(Context.ACTIVITY_SERVICE);
    int iconSize=(int)(activityManager.getLauncherLargeIconSize() * .67f);
    int w=bitmap.getWidth();
    int h=bitmap.getHeight();
    if (w == h) {
      if (w > iconSize) {
        Bitmap b=Bitmap.createScaledBitmap(bitmap,iconSize,iconSize,true);
        drawable=new BitmapDrawable(getResources(),b);
      }
 else       if (h < iconSize) {
        Bitmap b=Bitmap.createScaledBitmap(bitmap,iconSize,iconSize,true);
        drawable=new BitmapDrawable(getResources(),b);
      }
    }
  }
  preference.setIcon(drawable);
}

Fixed version (ground truth):
void setPreferenceIcon(Preference preference,Drawable drawable){
  if (drawable instanceof BitmapDrawable) {
    Bitmap bitmap=((BitmapDrawable)drawable).getBitmap();
    ActivityManager activityManager=(ActivityManager)getActivity().getSystemService(Context.ACTIVITY_SERVICE);
    int iconSize=(int)(activityManager.getLauncherLargeIconSize() * .67f);
    int w=bitmap.getWidth();
    int h=bitmap.getHeight();
    int largest=Math.max(w,h);
    if (largest > 0) {
      if (largest > iconSize) {
        Bitmap b=Bitmap.createScaledBitmap(bitmap,iconSize,iconSize,true);
        drawable=new BitmapDrawable(getResources(),b);
      }
 else       if (largest < iconSize) {
        Bitmap b=Bitmap.createScaledBitmap(bitmap,iconSize,iconSize,true);
        drawable=new BitmapDrawable(getResources(),b);
      }
    }
  }
  preference.setIcon(drawable);
}
Program: 104933
Project: 104933
Buggy source:
public ContentView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
}

Fixed version (ground truth):
public ContentView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  mLoadingString=getResources().getString(R.string.loading);
}
Program: 104934
Project: 104934
Buggy source:
void updateUrlTitleAndText(String urlAsString){
  String title=MainApplication.sTitleHashMap != null ? MainApplication.sTitleHashMap.get(urlAsString) : null;
  if (title == null) {
    title=getResources().getString(R.string.loading);
  }
  mTitleTextView.setText(title);
  if (urlAsString.equals(Constant.NEW_TAB_URL)) {
    mUrlTextView.setText(null);
  }
 else   if (urlAsString.equals(Constant.WELCOME_MESSAGE_URL)) {
    mUrlTextView.setText(Constant.WELCOME_MESSAGE_DISPLAY_URL);
  }
 else {
    mUrlTextView.setText(urlAsString.replace("String_Node_Str","String_Node_Str"));
  }
}

Fixed version (ground truth):
void updateUrlTitleAndText(String urlAsString){
  String title=MainApplication.sTitleHashMap != null ? MainApplication.sTitleHashMap.get(urlAsString) : null;
  if (title == null) {
    title=mLoadingString;
  }
  mTitleTextView.setText(title);
  if (urlAsString.equals(Constant.NEW_TAB_URL)) {
    mUrlTextView.setText(null);
  }
 else   if (urlAsString.equals(Constant.WELCOME_MESSAGE_URL)) {
    mUrlTextView.setText(Constant.WELCOME_MESSAGE_DISPLAY_URL);
  }
 else {
    mUrlTextView.setText(urlAsString.replace("String_Node_Str","String_Node_Str"));
  }
}
Program: 104935
Project: 104935
Buggy source:
public static void openAppStore(Context context,String url){
  PackageManager manager=context.getPackageManager();
  Intent intent=new Intent();
  intent.setAction(Intent.ACTION_VIEW);
  intent.setData(Uri.parse(url));
  List<ResolveInfo> infos=manager.queryIntentActivities(intent,PackageManager.GET_RESOLVED_FILTER);
  for (  ResolveInfo info : infos) {
    IntentFilter filter=info.filter;
    if (filter != null && filter.hasAction(Intent.ACTION_VIEW) && filter.hasCategory(Intent.CATEGORY_BROWSABLE)) {
      if (info.activityInfo.packageName.equals(BuildConfig.STORE_PACKAGE)) {
        MainApplication.loadIntent(context,info.activityInfo.packageName,info.activityInfo.name,BuildConfig.STORE_PRO_URL,-1,true);
        return;
      }
    }
  }
}

Fixed version (ground truth):
public static void openAppStore(Context context,String url){
  PackageManager manager=context.getPackageManager();
  Intent intent=new Intent();
  intent.setAction(Intent.ACTION_VIEW);
  intent.setData(Uri.parse(url));
  List<ResolveInfo> infos=manager.queryIntentActivities(intent,PackageManager.GET_RESOLVED_FILTER);
  for (  ResolveInfo info : infos) {
    IntentFilter filter=info.filter;
    if (filter != null && filter.hasAction(Intent.ACTION_VIEW) && filter.hasCategory(Intent.CATEGORY_BROWSABLE)) {
      if (info.activityInfo.packageName.equals(BuildConfig.STORE_PACKAGE)) {
        MainApplication.loadIntent(context,info.activityInfo.packageName,info.activityInfo.name,url,-1,true);
        return;
      }
    }
  }
}
Program: 104936
Project: 104936
Buggy source:
public ProgressImageView(Context context){
  super(context);
  mRotationAnimation=new RotateAnim(0,360,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
  mRotationAnimation.setInterpolator(new LinearInterpolator());
  mRotationAnimation.setRepeatCount(Animation.INFINITE);
  mRotationAnimation.setDuration(1000);
}

Fixed version (ground truth):
public ProgressImageView(Context context){
  super(context);
  mRotationAnimation=new RotateAnim(0,359,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
  mRotationAnimation.setInterpolator(new LinearInterpolator());
  mRotationAnimation.setRepeatCount(Animation.INFINITE);
  mRotationAnimation.setDuration(1000);
}
Program: 104937
Project: 104937
Buggy source:
public static void checkRestoreCurrentTabs(Context context){
  Vector<String> urls=Settings.get().loadCurrentTabs();
  if (urls.size() > 0) {
    MainApplication.restoreLinks(context,urls.toArray(new String[urls.size()]));
  }
}

Fixed version (ground truth):
public static void checkRestoreCurrentTabs(Context context){
  if (MainController.get() == null) {
    Vector<String> urls=Settings.get().loadCurrentTabs();
    if (urls.size() > 0) {
      MainApplication.restoreLinks(context,urls.toArray(new String[urls.size()]));
    }
  }
}
Program: 104938
Project: 104938
Buggy source:
@Override public boolean onInterceptTouchEvent(MotionEvent event){
  final int action=event.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && mInterceptingTouch && mTouchInterceptor != null) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
    if (mActiveTouchPointerId == INVALID_POINTER) {
      break;
    }
  final int pointerIndex=event.findPointerIndex(mActiveTouchPointerId);
if (pointerIndex == -1) {
  Log.e(TAG,"String_Node_Str" + mActiveTouchPointerId + "String_Node_Str");
  break;
}
final int y=(int)event.getY(pointerIndex);
final int yDiff=(int)Math.abs(y - mLastMotionY);
if (yDiff > 0) {
mLastMotionY=y;
if (mTouchInterceptor != null) {
mInterceptingTouch=true;
}
}
case MotionEvent.ACTION_DOWN:
mLastMotionY=(int)event.getY();
mActiveTouchPointerId=event.getPointerId(0);
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (!mInterceptingTouch) {
final float bubblePeriod=(float)Constant.BUBBLE_ANIM_TIME / 1000.f;
final float contentPeriod=bubblePeriod * 0.666667f;
MainController.get().expandBubbleFlow((long)(contentPeriod * 1000));
}
mActiveTouchPointerId=INVALID_POINTER;
mInterceptingTouch=false;
break;
}
if (super.onInterceptTouchEvent(event)) {
return true;
}
return mInterceptingTouch;
}

Fixed version (ground truth):
@Override public boolean onInterceptTouchEvent(MotionEvent event){
  final int action=event.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && mInterceptingTouch && mTouchInterceptor != null) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
    if (mActiveTouchPointerId == INVALID_POINTER) {
      break;
    }
  final int pointerIndex=event.findPointerIndex(mActiveTouchPointerId);
if (pointerIndex == -1) {
  Log.e(TAG,"String_Node_Str" + mActiveTouchPointerId + "String_Node_Str");
  break;
}
final int y=(int)event.getY(pointerIndex);
final int yDiff=Math.abs(y - mLastMotionY);
if (yDiff > 0) {
mLastMotionY=y;
if (mTouchInterceptor != null) {
mInterceptingTouch=true;
}
}
case MotionEvent.ACTION_DOWN:
mLastMotionY=(int)event.getY();
mActiveTouchPointerId=event.getPointerId(0);
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (!mInterceptingTouch) {
final float bubblePeriod=(float)Constant.BUBBLE_ANIM_TIME / 1000.f;
final float contentPeriod=bubblePeriod * 0.666667f;
MainController.get().expandBubbleFlow((long)(contentPeriod * 1000));
}
mActiveTouchPointerId=INVALID_POINTER;
mInterceptingTouch=false;
break;
}
if (super.onInterceptTouchEvent(event)) {
return true;
}
return mInterceptingTouch;
}
Program: 104939
Project: 104939
Buggy source:
public boolean closeTab(TabView tabView,Config.BubbleAction action,boolean animateOff){
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(mContext);
  boolean debug=prefs.getBoolean("String_Node_Str",false);
  if (debug) {
    Toast.makeText(mContext,"String_Node_Str",400).show();
  }
 else {
    mBubbleFlowDraggable.closeTab(tabView,animateOff,action,tabView.getTotalTrackedLoadTime());
    int activeTabCount=getActiveTabCount();
    showBadge(activeTabCount > 1 ? true : false);
    if (activeTabCount == 0) {
      hideBubbleDraggable();
      scheduleUpdate();
    }
  }
  return getActiveTabCount() > 0;
}

Fixed version (ground truth):
public boolean closeTab(TabView tabView,Config.BubbleAction action,boolean animateOff){
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(mContext);
  boolean debug=prefs.getBoolean("String_Node_Str",false);
  if (debug) {
    Toast.makeText(mContext,"String_Node_Str",Toast.LENGTH_SHORT).show();
  }
 else {
    mBubbleFlowDraggable.closeTab(tabView,animateOff,action,tabView.getTotalTrackedLoadTime());
    int activeTabCount=getActiveTabCount();
    showBadge(activeTabCount > 1 ? true : false);
    if (activeTabCount == 0) {
      hideBubbleDraggable();
      scheduleUpdate();
    }
  }
  return getActiveTabCount() > 0;
}
Program: 104940
Project: 104940
Buggy source:
public void setImitator(BubbleView bubbleView){
  mImitator=bubbleView;
  if (mImitator != null) {
    String tag=(String)mFavicon.getTag();
    Drawable drawable=mFavicon.getDrawable();
    if (tag != null && drawable != null) {
      mImitator.setFavicon(((BitmapDrawable)drawable).getBitmap(),tag);
    }
 else {
      setFallbackFavicon();
    }
    mImitator.mProgressIndicator.setProgress(mProgressIndicator.isIndicatorShowing(),mProgressIndicator.getProgress(),mUrl);
  }
}

Fixed version (ground truth):
public void setImitator(BubbleView bubbleView){
  mImitator=bubbleView;
  if (mImitator != null) {
    String tag=(String)mFavicon.getTag();
    Drawable drawable=mFavicon.getDrawable();
    if (tag != null && drawable != null) {
      mImitator.setFavicon(((BitmapDrawable)drawable).getBitmap(),tag);
    }
 else {
      mImitator.setFallbackFavicon();
    }
    mImitator.mProgressIndicator.setProgress(mProgressIndicator.isIndicatorShowing(),mProgressIndicator.getProgress(),mUrl);
  }
}
Program: 104942
Project: 104942
Buggy source:
@Override public void onAnimationComplete(){
  MainApplication.postEvent(getContext(),mEndBubbleDragEvent);
  MainController mainController=MainController.get();
  if (mCurrentSnapTarget.getAction() == Config.BubbleAction.Destroy) {
    mainController.destroyAllBubbles();
    mMode=Mode.BubbleView;
  }
 else {
    if (mainController.destroyCurrentBubble(mCurrentSnapTarget.getAction())) {
      doAnimateToBubbleView();
    }
 else {
      mMode=Mode.BubbleView;
    }
  }
  onAnimComplete();
  mFlickActive=false;
  mCurrentSnapTarget.endSnapping();
  mCurrentSnapTarget=null;
}

Fixed version (ground truth):
@Override public void onAnimationComplete(){
  MainApplication.postEvent(getContext(),mEndBubbleDragEvent);
  MainController mainController=MainController.get();
  onAnimComplete();
  mFlickActive=false;
  Config.BubbleAction action=mCurrentSnapTarget.getAction();
  mCurrentSnapTarget.endSnapping();
  mCurrentSnapTarget=null;
  if (action == Config.BubbleAction.Destroy) {
    mainController.destroyAllBubbles();
    mMode=Mode.BubbleView;
  }
 else {
    if (mainController.destroyCurrentBubble(action)) {
      doAnimateToBubbleView();
    }
 else {
      mMode=Mode.BubbleView;
    }
  }
}
Program: 104944
Project: 104944
Buggy source:
private void doAnimateToBubbleView(){
  if (mMode == Mode.BubbleView)   return;
  mTouchDown=false;
  mMode=Mode.BubbleView;
  if (MainController.get().getBubbleCount() == 0) {
    throw new RuntimeException("String_Node_Str");
  }
  float bubblePeriod=(float)Constant.BUBBLE_ANIM_TIME / 1000.f;
  float contentPeriod=bubblePeriod * 0.666667f;
  MainController mainController=MainController.get();
  setVisibility(View.VISIBLE);
  int xp=Config.BUBBLE_HOME_X;
  int yp=Config.BUBBLE_HOME_Y;
  setTargetPos(xp,yp,bubblePeriod,DraggableHelper.AnimationType.SmallOvershoot,new DraggableHelper.AnimationEventListener(){
    @Override public void onAnimationComplete(){
      MainApplication.postEvent(getContext(),mEndCollapseTransitionEvent);
      onAnimComplete();
    }
  }
);
  mainController.endAppPolling();
  mainController.collapseBubbleFlow((long)(contentPeriod * 1000));
  mBeginCollapseTransitionEvent.mPeriod=contentPeriod;
  MainApplication.postEvent(getContext(),mBeginCollapseTransitionEvent);
}

Fixed version (ground truth):
private void doAnimateToBubbleView(){
  if (mMode == Mode.BubbleView && mAnimActive)   return;
  mTouchDown=false;
  mMode=Mode.BubbleView;
  if (MainController.get().getBubbleCount() == 0) {
    throw new RuntimeException("String_Node_Str");
  }
  float bubblePeriod=(float)Constant.BUBBLE_ANIM_TIME / 1000.f;
  float contentPeriod=bubblePeriod * 0.666667f;
  MainController mainController=MainController.get();
  setVisibility(View.VISIBLE);
  int xp=Config.BUBBLE_HOME_X;
  int yp=Config.BUBBLE_HOME_Y;
  setTargetPos(xp,yp,bubblePeriod,DraggableHelper.AnimationType.SmallOvershoot,new DraggableHelper.AnimationEventListener(){
    @Override public void onAnimationComplete(){
      MainApplication.postEvent(getContext(),mEndCollapseTransitionEvent);
      onAnimComplete();
    }
  }
);
  mainController.endAppPolling();
  mainController.collapseBubbleFlow((long)(contentPeriod * 1000));
  mBeginCollapseTransitionEvent.mPeriod=contentPeriod;
  MainApplication.postEvent(getContext(),mBeginCollapseTransitionEvent);
}
Program: 104945
Project: 104945
Buggy source:
@Override public void onPageFinished(WebView webView,String urlAsString){
  super.onPageFinished(webView,urlAsString);
  URL url=null;
  try {
    url=new URL(urlAsString);
  }
 catch (  MalformedURLException e) {
    e.printStackTrace();
  }
  if (isValidUrl(url)) {
    updateAppsForUrl(urlAsString);
    configureOpenInAppButton();
    configureOpenEmbedButton();
    mTitleTextView.setText(webView.getTitle());
    mUrlTextView.setText(urlAsString.replace("String_Node_Str","String_Node_Str"));
    if (--mLoadCount == 0) {
      mUrl=urlAsString;
      mCurrentLoadedUrl=mUrl;
      PageLoadInfo pageLoadInfo=new PageLoadInfo();
      pageLoadInfo.bmp=webView.getFavicon();
      pageLoadInfo.url=urlAsString;
      pageLoadInfo.mHost=url.getHost();
      pageLoadInfo.title=webView.getTitle();
      mEventHandler.onPageLoaded(pageLoadInfo);
      Log.d(TAG,"String_Node_Str" + urlAsString);
      if (mStartTime > -1) {
        Log.d("String_Node_Str","String_Node_Str" + ((System.currentTimeMillis() - mStartTime) / 1000) + "String_Node_Str");
        mStartTime=-1;
      }
      if (Settings.get().checkForYouTubeEmbeds()) {
        webView.loadUrl(JS_EMBED);
        Log.d(TAG,"String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onPageFinished(WebView webView,String urlAsString){
  super.onPageFinished(webView,urlAsString);
  mPageFinishedLoading=true;
  URL url=null;
  try {
    url=new URL(urlAsString);
  }
 catch (  MalformedURLException e) {
    e.printStackTrace();
  }
  if (isValidUrl(url)) {
    updateAppsForUrl(urlAsString);
    configureOpenInAppButton();
    configureOpenEmbedButton();
    mTitleTextView.setText(webView.getTitle());
    mUrlTextView.setText(urlAsString.replace("String_Node_Str","String_Node_Str"));
    if (--mLoadCount == 0) {
      mUrl=urlAsString;
      mCurrentLoadedUrl=mUrl;
      PageLoadInfo pageLoadInfo=new PageLoadInfo();
      pageLoadInfo.bmp=webView.getFavicon();
      pageLoadInfo.url=urlAsString;
      pageLoadInfo.mHost=url.getHost();
      pageLoadInfo.title=webView.getTitle();
      mEventHandler.onPageLoaded(pageLoadInfo);
      Log.d(TAG,"String_Node_Str" + urlAsString);
      if (mStartTime > -1) {
        Log.d("String_Node_Str","String_Node_Str" + ((System.currentTimeMillis() - mStartTime) / 1000) + "String_Node_Str");
        mStartTime=-1;
      }
      if (Settings.get().checkForYouTubeEmbeds()) {
        webView.loadUrl(JS_EMBED);
        Log.d(TAG,"String_Node_Str");
      }
    }
  }
}
Program: 104946
Project: 104946
Buggy source:
@Override public void onReceivedIcon(WebView webView,Bitmap bitmap){
  super.onReceivedIcon(webView,bitmap);
  mEventHandler.onReceivedIcon(bitmap);
}

Fixed version (ground truth):
@Override public void onReceivedIcon(WebView webView,Bitmap bitmap){
  super.onReceivedIcon(webView,bitmap);
  if (mPageFinishedLoading) {
    mEventHandler.onReceivedIcon(bitmap);
  }
}
Program: 104947
Project: 104947
Buggy source:
@Override public void onPageStarted(WebView view,String url,Bitmap favIcon){
  if (isValidUrl(url)) {
    mLoadCount=Math.max(mLoadCount,1);
  }
  if (mShareButton.getVisibility() == GONE) {
    mShareButton.setVisibility(VISIBLE);
  }
}

Fixed version (ground truth):
@Override public void onPageStarted(WebView view,String url,Bitmap favIcon){
  mPageFinishedLoading=false;
  if (isValidUrl(url)) {
    mLoadCount=Math.max(mLoadCount,1);
  }
  if (mShareButton.getVisibility() == GONE) {
    mShareButton.setVisibility(VISIBLE);
  }
}
Program: 104950
Project: 104950
Buggy source:
@Override public void onDestroyDraggable(Draggable sender){
  if (mDraggables.size() > 1) {
    BubbleLegacyView bubbleView=sender.getBubbleLegacyView();
    int bubbleIndex=bubbleView.getBubbleIndex();
    destroyBubble(sender,Config.BubbleAction.Destroy);
    int nextBubbleIndex=Util.clamp(0,bubbleIndex,mDraggables.size() - 1);
    Draggable nextBubble=mDraggables.get(nextBubbleIndex);
    STATE_ContentView.setActiveBubble(nextBubble);
  }
 else {
    STATE_KillBubble.init(sender);
    switchState(STATE_KillBubble);
  }
}

Fixed version (ground truth):
@Override public void onDestroyDraggable(Draggable sender){
  if (mDraggables.size() > 1) {
    BubbleLegacyView bubbleView=sender.getBubbleLegacyView();
    int bubbleIndex=bubbleView.getBubbleIndex();
    destroyBubble(sender,Config.BubbleAction.Destroy);
    int nextBubbleIndex=Util.clamp(0,bubbleIndex,mDraggables.size() - 1);
    Draggable nextBubble=mDraggables.get(nextBubbleIndex);
    if (mCurrentState == STATE_ContentView) {
      STATE_ContentView.setActiveBubble(nextBubble);
    }
  }
 else {
    STATE_KillBubble.init(sender);
    switchState(STATE_KillBubble);
  }
}
Program: 104951
Project: 104951
Buggy source:
public BadgeView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
}

Fixed version (ground truth):
public BadgeView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  mAnimState=AnimState.None;
}
Program: 104952
Project: 104952
Buggy source:
public void show(){
  if (getVisibility() == View.VISIBLE) {
    return;
  }
  setAlpha(0f);
  setVisibility(View.VISIBLE);
  setScaleX(0.33f);
  setScaleY(0.33f);
  animate().alpha(1f).scaleX(1f).scaleY(1f).setDuration(667).setInterpolator(new AnticipateOvershootInterpolator()).setListener(mShowListener).start();
  if (mBubble != null) {
    FrameLayout.LayoutParams lp=(FrameLayout.LayoutParams)getLayoutParams();
    int x=mBubble.getXPos();
    if (x > Config.mScreenCenterX) {
      lp.gravity=Gravity.TOP | Gravity.LEFT;
    }
 else {
      lp.gravity=Gravity.TOP | Gravity.RIGHT;
    }
  }
}

Fixed version (ground truth):
public void show(){
  if (getVisibility() != View.VISIBLE) {
    setAlpha(0f);
    setVisibility(View.VISIBLE);
    setScaleX(0.33f);
    setScaleY(0.33f);
  }
 else   if (mAnimState == AnimState.Hiding) {
    animate().cancel();
    setVisibility(View.VISIBLE);
  }
  animate().alpha(1f).scaleX(1f).scaleY(1f).setDuration(667).setInterpolator(new AnticipateOvershootInterpolator()).setListener(mShowListener).start();
  if (mBubble != null) {
    FrameLayout.LayoutParams lp=(FrameLayout.LayoutParams)getLayoutParams();
    int x=mBubble.getXPos();
    if (x > Config.mScreenCenterX) {
      lp.gravity=Gravity.TOP | Gravity.LEFT;
    }
 else {
      lp.gravity=Gravity.TOP | Gravity.RIGHT;
    }
  }
}
Program: 104953
Project: 104953
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mSmoothInterpolator=new AccelerateDecelerateInterpolator();
  mHeaderHeight=getResources().getDimensionPixelSize(R.dimen.header_height);
  mMinHeaderTranslation=-mHeaderHeight + getActionBarHeight();
  setContentView(R.layout.activity_home);
  mListView=(ListView)findViewById(R.id.listview);
  mHeader=findViewById(R.id.header);
  mHeaderPicture=(KenBurnsView)findViewById(R.id.header_picture);
  mHeaderPicture.setResourceIds(R.drawable.picture0,R.drawable.picture1);
  mHeaderLogo=(ImageView)findViewById(R.id.header_logo);
  mActionBarTitleColor=getResources().getColor(R.color.actionbar_title_color);
  mSpannableString=new SpannableString(getString(R.string.home_activity_label));
  mAlphaForegroundColorSpan=new AlphaForegroundColorSpan(mActionBarTitleColor);
  setupActionBar();
  mPlaceHolderView=getLayoutInflater().inflate(R.layout.view_home_header,mListView,false);
  mListView.addHeaderView(mPlaceHolderView);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mSmoothInterpolator=new AccelerateDecelerateInterpolator();
  mHeaderHeight=getResources().getDimensionPixelSize(R.dimen.header_height);
  mMinHeaderTranslation=-mHeaderHeight + getActionBarHeight();
  setContentView(R.layout.activity_home);
  mListView=(ListView)findViewById(R.id.listview);
  mHeader=findViewById(R.id.header);
  mHeaderPicture=(KenBurnsView)findViewById(R.id.header_picture);
  mHeaderPicture.setResourceIds(R.drawable.picture0,R.drawable.picture1);
  mHeaderLogo=(ImageView)findViewById(R.id.header_logo);
  mActionBarTitleColor=getResources().getColor(R.color.actionbar_title_color);
  mSpannableString=new SpannableString(getString(R.string.home_activity_label));
  mAlphaForegroundColorSpan=new AlphaForegroundColorSpan(mActionBarTitleColor);
  setupActionBar();
  mPlaceHolderView=getLayoutInflater().inflate(R.layout.view_home_header,mListView,false);
  mListView.addHeaderView(mPlaceHolderView);
  if (Settings.get().debugAutoLoadUrl()) {
    MainApplication.openLink(this,"String_Node_Str",false);
  }
}
Program: 104955
Project: 104955
Buggy source:
@Override public boolean OnUpdate(float dt){
  if (mTouchBubble != null) {
    ++mTouchFrameCount;
    if (mTouchFrameCount == 6) {
      mCanvas.fadeInTargets();
    }
    mTouchBubble.doSnap(mCanvas,mTargetX,mTargetY);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean OnUpdate(float dt){
  if (mTouchBubble != null) {
    ++mTouchFrameCount;
    if (mTouchFrameCount == 6) {
      mCanvas.fadeInTargets();
    }
    if (mDidMove) {
      mTouchBubble.doSnap(mCanvas,mTargetX,mTargetY);
    }
    return true;
  }
  return false;
}
Program: 104956
Project: 104956
Buggy source:
public CondensedTextView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  if (sCustomTypeface == null) {
    sCustomTypeface=Typeface.createFromAsset(context.getAssets(),"String_Node_Str");
  }
  setTypeface(sCustomTypeface);
}

Fixed version (ground truth):
public CondensedTextView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  if (isInEditMode() == false) {
    if (sCustomTypeface == null) {
      sCustomTypeface=Typeface.createFromAsset(context.getAssets(),"String_Node_Str");
    }
    setTypeface(sCustomTypeface);
  }
}
Program: 104957
Project: 104957
Buggy source:
@Override public void OnMotionEvent_Release(Bubble sender,Bubble.ReleaseEvent e){
  sender.clearTargetPos();
  if (mDidMove) {
    Canvas.TargetInfo ti=mTouchBubble.getTargetInfo(mCanvas,sender.getXPos(),sender.getYPos());
    if (ti.mAction == Config.BubbleAction.None) {
      float v=(float)Math.sqrt(e.vx * e.vx + e.vy * e.vy);
      float threshold=Config.dpToPx(900.0f);
      if (v > threshold) {
        MainController.STATE_Flick.init(sender,e.vx,e.vy,false);
        MainController.switchState(MainController.STATE_Flick);
      }
 else {
        MainController.STATE_SnapToEdge.init(sender);
        MainController.switchState(MainController.STATE_SnapToEdge);
      }
    }
 else {
      if (MainController.destroyBubble(mTouchBubble,ti.mAction)) {
        MainController.STATE_AnimateToContentView.init(MainController.getBubble(MainController.getBubbleCount() - 1));
        MainController.switchState(MainController.STATE_AnimateToContentView);
      }
 else {
        MainController.switchState(MainController.STATE_BubbleView);
      }
    }
  }
 else   if (mActiveBubble != sender) {
    mActiveBubble=sender;
    mCanvas.setContentView(mActiveBubble.getContentView());
    mCanvas.showContentView();
    mCanvas.setContentViewTranslation(0.0f);
  }
 else {
    MainController.switchState(MainController.STATE_AnimateToBubbleView);
  }
  mTouchBubble=null;
}

Fixed version (ground truth):
@Override public void OnMotionEvent_Release(Bubble sender,Bubble.ReleaseEvent e){
  sender.clearTargetPos();
  if (mDidMove) {
    Canvas.TargetInfo ti=mTouchBubble.getTargetInfo(mCanvas,sender.getXPos(),sender.getYPos());
    if (ti.mAction == Config.BubbleAction.None) {
      float v=(float)Math.sqrt(e.vx * e.vx + e.vy * e.vy);
      float threshold=Config.dpToPx(900.0f);
      if (v > threshold) {
        MainController.STATE_Flick.init(sender,e.vx,e.vy,true);
        MainController.switchState(MainController.STATE_Flick);
      }
 else {
        MainController.STATE_AnimateToContentView.init(mTouchBubble);
        MainController.switchState(MainController.STATE_AnimateToContentView);
      }
    }
 else {
      if (MainController.destroyBubble(mTouchBubble,ti.mAction)) {
        MainController.STATE_AnimateToContentView.init(MainController.getBubble(MainController.getBubbleCount() - 1));
        MainController.switchState(MainController.STATE_AnimateToContentView);
      }
 else {
        MainController.switchState(MainController.STATE_BubbleView);
      }
    }
  }
 else   if (mActiveBubble != sender) {
    mActiveBubble=sender;
    mCanvas.setContentView(mActiveBubble.getContentView());
    mCanvas.showContentView();
    mCanvas.setContentViewTranslation(0.0f);
  }
 else {
    MainController.switchState(MainController.STATE_AnimateToBubbleView);
  }
  mTouchBubble=null;
}
Program: 104959
Project: 104959
Buggy source:
@Override public void OnExitState(){
  MainController.setAllBubblePositions(mBubble);
  mBubble=null;
}

Fixed version (ground truth):
@Override public void OnExitState(){
  if (!mContentViewActive)   MainController.setAllBubblePositions(mBubble);
  mBubble=null;
}
Program: 104961
Project: 104961
Buggy source:
@Override protected void onStop(){
  super.onStop();
  try {
    unbindService(mConnection);
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
@Override protected void onStop(){
  super.onStop();
  try {
    unbindService(mConnection);
  }
 catch (  Exception e) {
  }
  delayedFinishIfCurrent();
}