nus-yam/ex-repair huggingface dataset:
Program: 23390
Project: 23390
Buggy source:
public void executeMessage(Message message){
switch (message.what) {
case DO_ATTACH:
{
      try {
        mConnection.attachEngine(this);
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str",e);
        return;
      }
      Engine engine=onCreateEngine();
      mEngine=engine;
      engine.attach(this);
      return;
    }
case DO_DETACH:
{
    mEngine.detach();
    return;
  }
case DO_SET_DESIRED_SIZE:
{
  mEngine.doDesiredSizeChanged(message.arg1,message.arg2);
  return;
}
case MSG_UPDATE_SURFACE:
mEngine.updateSurface(true,false);
break;
case MSG_VISIBILITY_CHANGED:
if (DEBUG) Log.v(TAG,"String_Node_Str" + mEngine + "String_Node_Str"+ message.arg1);
mEngine.doVisibilityChanged(message.arg1 != 0);
break;
case MSG_WALLPAPER_OFFSETS:
{
mEngine.doOffsetsChanged();
}
break;
case MSG_WALLPAPER_COMMAND:
{
WallpaperCommand cmd=(WallpaperCommand)message.obj;
mEngine.doCommand(cmd);
}
break;
case MSG_WINDOW_RESIZED:
{
final boolean reportDraw=message.arg1 != 0;
mEngine.updateSurface(true,false);
if (reportDraw) {
try {
mEngine.mSession.finishDrawing(mEngine.mWindow);
}
 catch (RemoteException e) {
}
}
}
break;
case MSG_TOUCH_EVENT:
{
MotionEvent ev=(MotionEvent)message.obj;
synchronized (mEngine.mLock) {
if (mEngine.mPendingMove == ev) {
mEngine.mPendingMove=null;
}
}
if (DEBUG) Log.v(TAG,"String_Node_Str" + ev);
mEngine.onTouchEvent(ev);
ev.recycle();
}
break;
default :
Log.w(TAG,"String_Node_Str" + message.what);
}
}

Fixed version (ground truth):
public void executeMessage(Message message){
switch (message.what) {
case DO_ATTACH:
{
      try {
        mConnection.attachEngine(this);
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str",e);
        return;
      }
      Engine engine=onCreateEngine();
      mEngine=engine;
      mActiveEngines.add(engine);
      engine.attach(this);
      return;
    }
case DO_DETACH:
{
    mActiveEngines.remove(mEngine);
    mEngine.detach();
    return;
  }
case DO_SET_DESIRED_SIZE:
{
  mEngine.doDesiredSizeChanged(message.arg1,message.arg2);
  return;
}
case MSG_UPDATE_SURFACE:
mEngine.updateSurface(true,false);
break;
case MSG_VISIBILITY_CHANGED:
if (DEBUG) Log.v(TAG,"String_Node_Str" + mEngine + "String_Node_Str"+ message.arg1);
mEngine.doVisibilityChanged(message.arg1 != 0);
break;
case MSG_WALLPAPER_OFFSETS:
{
mEngine.doOffsetsChanged();
}
break;
case MSG_WALLPAPER_COMMAND:
{
WallpaperCommand cmd=(WallpaperCommand)message.obj;
mEngine.doCommand(cmd);
}
break;
case MSG_WINDOW_RESIZED:
{
final boolean reportDraw=message.arg1 != 0;
mEngine.updateSurface(true,false);
if (reportDraw) {
try {
mEngine.mSession.finishDrawing(mEngine.mWindow);
}
 catch (RemoteException e) {
}
}
}
break;
case MSG_TOUCH_EVENT:
{
MotionEvent ev=(MotionEvent)message.obj;
synchronized (mEngine.mLock) {
if (mEngine.mPendingMove == ev) {
mEngine.mPendingMove=null;
}
}
if (DEBUG) Log.v(TAG,"String_Node_Str" + ev);
mEngine.onTouchEvent(ev);
ev.recycle();
}
break;
default :
Log.w(TAG,"String_Node_Str" + message.what);
}
}
Program: 23391
Project: 23391
Buggy source:
/** 
 * Called once to initialize the engine.  After returning, the engine's surface will be created by the framework.
 */
public void onCreate(SurfaceHolder surfaceHolder){
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
}
Program: 23392
Project: 23392
Buggy source:
/** 
 * Called right before the engine is going away.  After this the surface will be destroyed and this Engine object is no longer valid.
 */
public void onDestroy(){
}

Fixed version (ground truth):
@Override public void onDestroy(){
  super.onDestroy();
  for (int i=0; i < mActiveEngines.size(); i++) {
    mActiveEngines.get(i).detach();
  }
  mActiveEngines.clear();
}
Program: 23393
Project: 23393
Buggy source:
void doVisibilityChanged(boolean visible){
  mVisible=visible;
  reportVisibility();
}

Fixed version (ground truth):
void doVisibilityChanged(boolean visible){
  if (!mDestroyed) {
    mVisible=visible;
    reportVisibility();
  }
}
Program: 23394
Project: 23394
Buggy source:
void detach(){
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  if (mDestroyReportNeeded) {
    mDestroyReportNeeded=false;
    SurfaceHolder.Callback callbacks[];
synchronized (mSurfaceHolder.mCallbacks) {
      callbacks=new SurfaceHolder.Callback[mSurfaceHolder.mCallbacks.size()];
      mSurfaceHolder.mCallbacks.toArray(callbacks);
    }
    for (    SurfaceHolder.Callback c : callbacks) {
      c.surfaceDestroyed(mSurfaceHolder);
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mSurfaceHolder + "String_Node_Str"+ this);
    onSurfaceDestroyed(mSurfaceHolder);
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}

Fixed version (ground truth):
void detach(){
  if (mDestroyed) {
    return;
  }
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  if (mDestroyReportNeeded) {
    mDestroyReportNeeded=false;
    SurfaceHolder.Callback callbacks[];
synchronized (mSurfaceHolder.mCallbacks) {
      callbacks=new SurfaceHolder.Callback[mSurfaceHolder.mCallbacks.size()];
      mSurfaceHolder.mCallbacks.toArray(callbacks);
    }
    for (    SurfaceHolder.Callback c : callbacks) {
      c.surfaceDestroyed(mSurfaceHolder);
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mSurfaceHolder + "String_Node_Str"+ this);
    onSurfaceDestroyed(mSurfaceHolder);
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}
Program: 23395
Project: 23395
Buggy source:
public void executeMessage(Message message){
switch (message.what) {
case DO_ATTACH:
{
      try {
        mConnection.attachEngine(this);
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str",e);
        return;
      }
      Engine engine=onCreateEngine();
      mEngine=engine;
      engine.attach(this);
      return;
    }
case DO_DETACH:
{
    mEngine.detach();
    return;
  }
case DO_SET_DESIRED_SIZE:
{
  mEngine.doDesiredSizeChanged(message.arg1,message.arg2);
  return;
}
case MSG_UPDATE_SURFACE:
mEngine.updateSurface(true,false);
break;
case MSG_VISIBILITY_CHANGED:
if (DEBUG) Log.v(TAG,"String_Node_Str" + mEngine + "String_Node_Str"+ message.arg1);
mEngine.doVisibilityChanged(message.arg1 != 0);
break;
case MSG_WALLPAPER_OFFSETS:
{
mEngine.doOffsetsChanged();
}
break;
case MSG_WALLPAPER_COMMAND:
{
WallpaperCommand cmd=(WallpaperCommand)message.obj;
mEngine.doCommand(cmd);
}
break;
case MSG_WINDOW_RESIZED:
{
final boolean reportDraw=message.arg1 != 0;
mEngine.updateSurface(true,false);
if (reportDraw) {
try {
mEngine.mSession.finishDrawing(mEngine.mWindow);
}
 catch (RemoteException e) {
}
}
}
break;
case MSG_TOUCH_EVENT:
{
MotionEvent ev=(MotionEvent)message.obj;
synchronized (mEngine.mLock) {
if (mEngine.mPendingMove == ev) {
mEngine.mPendingMove=null;
}
}
if (DEBUG) Log.v(TAG,"String_Node_Str" + ev);
mEngine.onTouchEvent(ev);
ev.recycle();
}
break;
default :
Log.w(TAG,"String_Node_Str" + message.what);
}
}

Fixed version (ground truth):
public void executeMessage(Message message){
switch (message.what) {
case DO_ATTACH:
{
      try {
        mConnection.attachEngine(this);
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str",e);
        return;
      }
      Engine engine=onCreateEngine();
      mEngine=engine;
      mActiveEngines.add(engine);
      engine.attach(this);
      return;
    }
case DO_DETACH:
{
    mActiveEngines.remove(mEngine);
    mEngine.detach();
    return;
  }
case DO_SET_DESIRED_SIZE:
{
  mEngine.doDesiredSizeChanged(message.arg1,message.arg2);
  return;
}
case MSG_UPDATE_SURFACE:
mEngine.updateSurface(true,false);
break;
case MSG_VISIBILITY_CHANGED:
if (DEBUG) Log.v(TAG,"String_Node_Str" + mEngine + "String_Node_Str"+ message.arg1);
mEngine.doVisibilityChanged(message.arg1 != 0);
break;
case MSG_WALLPAPER_OFFSETS:
{
mEngine.doOffsetsChanged();
}
break;
case MSG_WALLPAPER_COMMAND:
{
WallpaperCommand cmd=(WallpaperCommand)message.obj;
mEngine.doCommand(cmd);
}
break;
case MSG_WINDOW_RESIZED:
{
final boolean reportDraw=message.arg1 != 0;
mEngine.updateSurface(true,false);
if (reportDraw) {
try {
mEngine.mSession.finishDrawing(mEngine.mWindow);
}
 catch (RemoteException e) {
}
}
}
break;
case MSG_TOUCH_EVENT:
{
MotionEvent ev=(MotionEvent)message.obj;
synchronized (mEngine.mLock) {
if (mEngine.mPendingMove == ev) {
mEngine.mPendingMove=null;
}
}
if (DEBUG) Log.v(TAG,"String_Node_Str" + ev);
mEngine.onTouchEvent(ev);
ev.recycle();
}
break;
default :
Log.w(TAG,"String_Node_Str" + message.what);
}
}
Program: 23396
Project: 23396
Buggy source:
/** 
 * Called once to initialize the engine.  After returning, the engine's surface will be created by the framework.
 */
public void onCreate(SurfaceHolder surfaceHolder){
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
}
Program: 23397
Project: 23397
Buggy source:
/** 
 * Called right before the engine is going away.  After this the surface will be destroyed and this Engine object is no longer valid.
 */
public void onDestroy(){
}

Fixed version (ground truth):
@Override public void onDestroy(){
  super.onDestroy();
  for (int i=0; i < mActiveEngines.size(); i++) {
    mActiveEngines.get(i).detach();
  }
  mActiveEngines.clear();
}
Program: 23398
Project: 23398
Buggy source:
void doVisibilityChanged(boolean visible){
  mVisible=visible;
  reportVisibility();
}

Fixed version (ground truth):
void doVisibilityChanged(boolean visible){
  if (!mDestroyed) {
    mVisible=visible;
    reportVisibility();
  }
}
Program: 23399
Project: 23399
Buggy source:
void detach(){
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  if (mDestroyReportNeeded) {
    mDestroyReportNeeded=false;
    SurfaceHolder.Callback callbacks[];
synchronized (mSurfaceHolder.mCallbacks) {
      callbacks=new SurfaceHolder.Callback[mSurfaceHolder.mCallbacks.size()];
      mSurfaceHolder.mCallbacks.toArray(callbacks);
    }
    for (    SurfaceHolder.Callback c : callbacks) {
      c.surfaceDestroyed(mSurfaceHolder);
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mSurfaceHolder + "String_Node_Str"+ this);
    onSurfaceDestroyed(mSurfaceHolder);
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}

Fixed version (ground truth):
void detach(){
  if (mDestroyed) {
    return;
  }
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  if (mDestroyReportNeeded) {
    mDestroyReportNeeded=false;
    SurfaceHolder.Callback callbacks[];
synchronized (mSurfaceHolder.mCallbacks) {
      callbacks=new SurfaceHolder.Callback[mSurfaceHolder.mCallbacks.size()];
      mSurfaceHolder.mCallbacks.toArray(callbacks);
    }
    for (    SurfaceHolder.Callback c : callbacks) {
      c.surfaceDestroyed(mSurfaceHolder);
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mSurfaceHolder + "String_Node_Str"+ this);
    onSurfaceDestroyed(mSurfaceHolder);
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}
Program: 23400
Project: 23400
Buggy source:
public void executeMessage(Message message){
switch (message.what) {
case DO_ATTACH:
{
      try {
        mConnection.attachEngine(this);
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str",e);
        return;
      }
      Engine engine=onCreateEngine();
      mEngine=engine;
      engine.attach(this);
      return;
    }
case DO_DETACH:
{
    mEngine.detach();
    return;
  }
case DO_SET_DESIRED_SIZE:
{
  mEngine.doDesiredSizeChanged(message.arg1,message.arg2);
  return;
}
case MSG_UPDATE_SURFACE:
mEngine.updateSurface(true,false);
break;
case MSG_VISIBILITY_CHANGED:
if (DEBUG) Log.v(TAG,"String_Node_Str" + mEngine + "String_Node_Str"+ message.arg1);
mEngine.doVisibilityChanged(message.arg1 != 0);
break;
case MSG_WALLPAPER_OFFSETS:
{
mEngine.doOffsetsChanged();
}
break;
case MSG_WALLPAPER_COMMAND:
{
WallpaperCommand cmd=(WallpaperCommand)message.obj;
mEngine.doCommand(cmd);
}
break;
case MSG_WINDOW_RESIZED:
{
final boolean reportDraw=message.arg1 != 0;
mEngine.updateSurface(true,false);
if (reportDraw) {
try {
mEngine.mSession.finishDrawing(mEngine.mWindow);
}
 catch (RemoteException e) {
}
}
}
break;
case MSG_TOUCH_EVENT:
{
MotionEvent ev=(MotionEvent)message.obj;
synchronized (mEngine.mLock) {
if (mEngine.mPendingMove == ev) {
mEngine.mPendingMove=null;
}
}
if (DEBUG) Log.v(TAG,"String_Node_Str" + ev);
mEngine.onTouchEvent(ev);
ev.recycle();
}
break;
default :
Log.w(TAG,"String_Node_Str" + message.what);
}
}

Fixed version (ground truth):
public void executeMessage(Message message){
switch (message.what) {
case DO_ATTACH:
{
      try {
        mConnection.attachEngine(this);
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str",e);
        return;
      }
      Engine engine=onCreateEngine();
      mEngine=engine;
      mActiveEngines.add(engine);
      engine.attach(this);
      return;
    }
case DO_DETACH:
{
    mActiveEngines.remove(mEngine);
    mEngine.detach();
    return;
  }
case DO_SET_DESIRED_SIZE:
{
  mEngine.doDesiredSizeChanged(message.arg1,message.arg2);
  return;
}
case MSG_UPDATE_SURFACE:
mEngine.updateSurface(true,false);
break;
case MSG_VISIBILITY_CHANGED:
if (DEBUG) Log.v(TAG,"String_Node_Str" + mEngine + "String_Node_Str"+ message.arg1);
mEngine.doVisibilityChanged(message.arg1 != 0);
break;
case MSG_WALLPAPER_OFFSETS:
{
mEngine.doOffsetsChanged();
}
break;
case MSG_WALLPAPER_COMMAND:
{
WallpaperCommand cmd=(WallpaperCommand)message.obj;
mEngine.doCommand(cmd);
}
break;
case MSG_WINDOW_RESIZED:
{
final boolean reportDraw=message.arg1 != 0;
mEngine.updateSurface(true,false);
if (reportDraw) {
try {
mEngine.mSession.finishDrawing(mEngine.mWindow);
}
 catch (RemoteException e) {
}
}
}
break;
case MSG_TOUCH_EVENT:
{
MotionEvent ev=(MotionEvent)message.obj;
synchronized (mEngine.mLock) {
if (mEngine.mPendingMove == ev) {
mEngine.mPendingMove=null;
}
}
if (DEBUG) Log.v(TAG,"String_Node_Str" + ev);
mEngine.onTouchEvent(ev);
ev.recycle();
}
break;
default :
Log.w(TAG,"String_Node_Str" + message.what);
}
}
Program: 23401
Project: 23401
Buggy source:
/** 
 * Called once to initialize the engine.  After returning, the engine's surface will be created by the framework.
 */
public void onCreate(SurfaceHolder surfaceHolder){
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
}
Program: 23402
Project: 23402
Buggy source:
/** 
 * Called right before the engine is going away.  After this the surface will be destroyed and this Engine object is no longer valid.
 */
public void onDestroy(){
}

Fixed version (ground truth):
@Override public void onDestroy(){
  super.onDestroy();
  for (int i=0; i < mActiveEngines.size(); i++) {
    mActiveEngines.get(i).detach();
  }
  mActiveEngines.clear();
}
Program: 23403
Project: 23403
Buggy source:
void doVisibilityChanged(boolean visible){
  mVisible=visible;
  reportVisibility();
}

Fixed version (ground truth):
void doVisibilityChanged(boolean visible){
  if (!mDestroyed) {
    mVisible=visible;
    reportVisibility();
  }
}
Program: 23404
Project: 23404
Buggy source:
void detach(){
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  if (mDestroyReportNeeded) {
    mDestroyReportNeeded=false;
    SurfaceHolder.Callback callbacks[];
synchronized (mSurfaceHolder.mCallbacks) {
      callbacks=new SurfaceHolder.Callback[mSurfaceHolder.mCallbacks.size()];
      mSurfaceHolder.mCallbacks.toArray(callbacks);
    }
    for (    SurfaceHolder.Callback c : callbacks) {
      c.surfaceDestroyed(mSurfaceHolder);
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mSurfaceHolder + "String_Node_Str"+ this);
    onSurfaceDestroyed(mSurfaceHolder);
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}

Fixed version (ground truth):
void detach(){
  if (mDestroyed) {
    return;
  }
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  if (mDestroyReportNeeded) {
    mDestroyReportNeeded=false;
    SurfaceHolder.Callback callbacks[];
synchronized (mSurfaceHolder.mCallbacks) {
      callbacks=new SurfaceHolder.Callback[mSurfaceHolder.mCallbacks.size()];
      mSurfaceHolder.mCallbacks.toArray(callbacks);
    }
    for (    SurfaceHolder.Callback c : callbacks) {
      c.surfaceDestroyed(mSurfaceHolder);
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mSurfaceHolder + "String_Node_Str"+ this);
    onSurfaceDestroyed(mSurfaceHolder);
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}
Program: 23405
Project: 23405
Buggy source:
public void executeMessage(Message message){
switch (message.what) {
case DO_ATTACH:
{
      try {
        mConnection.attachEngine(this);
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str",e);
        return;
      }
      Engine engine=onCreateEngine();
      mEngine=engine;
      engine.attach(this);
      return;
    }
case DO_DETACH:
{
    mEngine.detach();
    return;
  }
case DO_SET_DESIRED_SIZE:
{
  mEngine.doDesiredSizeChanged(message.arg1,message.arg2);
  return;
}
case MSG_UPDATE_SURFACE:
mEngine.updateSurface(true,false);
break;
case MSG_VISIBILITY_CHANGED:
if (DEBUG) Log.v(TAG,"String_Node_Str" + mEngine + "String_Node_Str"+ message.arg1);
mEngine.doVisibilityChanged(message.arg1 != 0);
break;
case MSG_WALLPAPER_OFFSETS:
{
mEngine.doOffsetsChanged();
}
break;
case MSG_WALLPAPER_COMMAND:
{
WallpaperCommand cmd=(WallpaperCommand)message.obj;
mEngine.doCommand(cmd);
}
break;
case MSG_WINDOW_RESIZED:
{
final boolean reportDraw=message.arg1 != 0;
mEngine.updateSurface(true,false);
if (reportDraw) {
try {
mEngine.mSession.finishDrawing(mEngine.mWindow);
}
 catch (RemoteException e) {
}
}
}
break;
case MSG_TOUCH_EVENT:
{
MotionEvent ev=(MotionEvent)message.obj;
synchronized (mEngine.mLock) {
if (mEngine.mPendingMove == ev) {
mEngine.mPendingMove=null;
}
}
if (DEBUG) Log.v(TAG,"String_Node_Str" + ev);
mEngine.onTouchEvent(ev);
ev.recycle();
}
break;
default :
Log.w(TAG,"String_Node_Str" + message.what);
}
}

Fixed version (ground truth):
public void executeMessage(Message message){
switch (message.what) {
case DO_ATTACH:
{
      try {
        mConnection.attachEngine(this);
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str",e);
        return;
      }
      Engine engine=onCreateEngine();
      mEngine=engine;
      mActiveEngines.add(engine);
      engine.attach(this);
      return;
    }
case DO_DETACH:
{
    mActiveEngines.remove(mEngine);
    mEngine.detach();
    return;
  }
case DO_SET_DESIRED_SIZE:
{
  mEngine.doDesiredSizeChanged(message.arg1,message.arg2);
  return;
}
case MSG_UPDATE_SURFACE:
mEngine.updateSurface(true,false);
break;
case MSG_VISIBILITY_CHANGED:
if (DEBUG) Log.v(TAG,"String_Node_Str" + mEngine + "String_Node_Str"+ message.arg1);
mEngine.doVisibilityChanged(message.arg1 != 0);
break;
case MSG_WALLPAPER_OFFSETS:
{
mEngine.doOffsetsChanged();
}
break;
case MSG_WALLPAPER_COMMAND:
{
WallpaperCommand cmd=(WallpaperCommand)message.obj;
mEngine.doCommand(cmd);
}
break;
case MSG_WINDOW_RESIZED:
{
final boolean reportDraw=message.arg1 != 0;
mEngine.updateSurface(true,false);
if (reportDraw) {
try {
mEngine.mSession.finishDrawing(mEngine.mWindow);
}
 catch (RemoteException e) {
}
}
}
break;
case MSG_TOUCH_EVENT:
{
MotionEvent ev=(MotionEvent)message.obj;
synchronized (mEngine.mLock) {
if (mEngine.mPendingMove == ev) {
mEngine.mPendingMove=null;
}
}
if (DEBUG) Log.v(TAG,"String_Node_Str" + ev);
mEngine.onTouchEvent(ev);
ev.recycle();
}
break;
default :
Log.w(TAG,"String_Node_Str" + message.what);
}
}
Program: 23406
Project: 23406
Buggy source:
/** 
 * Called once to initialize the engine.  After returning, the engine's surface will be created by the framework.
 */
public void onCreate(SurfaceHolder surfaceHolder){
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
}
Program: 23407
Project: 23407
Buggy source:
/** 
 * Called right before the engine is going away.  After this the surface will be destroyed and this Engine object is no longer valid.
 */
public void onDestroy(){
}

Fixed version (ground truth):
@Override public void onDestroy(){
  super.onDestroy();
  for (int i=0; i < mActiveEngines.size(); i++) {
    mActiveEngines.get(i).detach();
  }
  mActiveEngines.clear();
}
Program: 23408
Project: 23408
Buggy source:
void doVisibilityChanged(boolean visible){
  mVisible=visible;
  reportVisibility();
}

Fixed version (ground truth):
void doVisibilityChanged(boolean visible){
  if (!mDestroyed) {
    mVisible=visible;
    reportVisibility();
  }
}
Program: 23409
Project: 23409
Buggy source:
void detach(){
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  if (mDestroyReportNeeded) {
    mDestroyReportNeeded=false;
    SurfaceHolder.Callback callbacks[];
synchronized (mSurfaceHolder.mCallbacks) {
      callbacks=new SurfaceHolder.Callback[mSurfaceHolder.mCallbacks.size()];
      mSurfaceHolder.mCallbacks.toArray(callbacks);
    }
    for (    SurfaceHolder.Callback c : callbacks) {
      c.surfaceDestroyed(mSurfaceHolder);
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mSurfaceHolder + "String_Node_Str"+ this);
    onSurfaceDestroyed(mSurfaceHolder);
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}

Fixed version (ground truth):
void detach(){
  if (mDestroyed) {
    return;
  }
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  if (mDestroyReportNeeded) {
    mDestroyReportNeeded=false;
    SurfaceHolder.Callback callbacks[];
synchronized (mSurfaceHolder.mCallbacks) {
      callbacks=new SurfaceHolder.Callback[mSurfaceHolder.mCallbacks.size()];
      mSurfaceHolder.mCallbacks.toArray(callbacks);
    }
    for (    SurfaceHolder.Callback c : callbacks) {
      c.surfaceDestroyed(mSurfaceHolder);
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mSurfaceHolder + "String_Node_Str"+ this);
    onSurfaceDestroyed(mSurfaceHolder);
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}
Program: 23410
Project: 23410
Buggy source:
private synchronized final void sendIntent(){
  Intent intent=new Intent(Intent.ACTION_HEADSET_PLUG);
  intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
  int state=0;
  int microphone=0;
  if ((mHeadsetState & BIT_HEADSET) != (mPrevHeadsetState & BIT_HEADSET)) {
    microphone=1;
    if ((mHeadsetState & BIT_HEADSET) != 0) {
      state=1;
    }
  }
 else   if ((mHeadsetState & BIT_HEADSET_NO_MIC) != (mPrevHeadsetState & BIT_HEADSET_NO_MIC)) {
    if ((mHeadsetState & BIT_HEADSET_NO_MIC) != 0) {
      state=1;
    }
  }
  intent.putExtra("String_Node_Str",state);
  intent.putExtra("String_Node_Str",mHeadsetName);
  intent.putExtra("String_Node_Str",microphone);
  ActivityManagerNative.broadcastStickyIntent(intent,null);
}

Fixed version (ground truth):
private final void sendIntent(int headset){
  if ((mHeadsetState & headset) != (mPrevHeadsetState & headset)) {
    Intent intent=new Intent(Intent.ACTION_HEADSET_PLUG);
    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
    int state=0;
    int microphone=0;
    if ((headset & HEADSETS_WITH_MIC) != 0) {
      microphone=1;
    }
    if ((mHeadsetState & headset) != 0) {
      state=1;
    }
    intent.putExtra("String_Node_Str",state);
    intent.putExtra("String_Node_Str",mHeadsetName);
    intent.putExtra("String_Node_Str",microphone);
    if (LOG)     Log.v(TAG,"String_Node_Str" + state + "String_Node_Str"+ mHeadsetName+ "String_Node_Str"+ microphone);
    ActivityManagerNative.broadcastStickyIntent(intent,null);
  }
}
Program: 23411
Project: 23411
Buggy source:
@Override public void handleMessage(Message msg){
  if (mPendingIntent) {
    sendIntent();
    mPendingIntent=false;
  }
  mWakeLock.release();
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  if (mPendingIntent) {
    sendIntents();
    mPendingIntent=false;
  }
  mWakeLock.release();
}
Program: 23412
Project: 23412
Buggy source:
private synchronized final void update(String newName,int newState){
  int headsetState=newState & (BIT_HEADSET | BIT_HEADSET_NO_MIC);
  if (headsetState != mHeadsetState) {
    boolean isUnplug=false;
    if (((mHeadsetState & BIT_HEADSET) != 0 && (headsetState & BIT_HEADSET) == 0) || ((mHeadsetState & BIT_HEADSET_NO_MIC) != 0 && (headsetState & BIT_HEADSET_NO_MIC) == 0)) {
      isUnplug=true;
    }
    mHeadsetName=newName;
    mPrevHeadsetState=mHeadsetState;
    mHeadsetState=headsetState;
    mPendingIntent=true;
    if (isUnplug) {
      Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
      mContext.sendBroadcast(intent);
      mWakeLock.acquire();
      mHandler.sendEmptyMessageDelayed(0,1000);
    }
 else {
      sendIntent();
      mPendingIntent=false;
    }
  }
}

Fixed version (ground truth):
private synchronized final void update(String newName,int newState){
  int headsetState=newState & SUPPORTED_HEADSETS;
  int newOrOld=headsetState | mHeadsetState;
  if (mHeadsetState == headsetState || ((newOrOld & (newOrOld - 1)) != 0)) {
    return;
  }
  mHeadsetName=newName;
  mPrevHeadsetState=mHeadsetState;
  mHeadsetState=headsetState;
  mPendingIntent=true;
  if (headsetState == 0) {
    Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    mContext.sendBroadcast(intent);
    mWakeLock.acquire();
    mHandler.sendEmptyMessageDelayed(0,1000);
  }
 else {
    sendIntents();
    mPendingIntent=false;
  }
}
Program: 23413
Project: 23413
Buggy source:
public void appendAndroidSpecificProperty(final String mimeType,ContentValues contentValues){
  List<String> rawValueList=new ArrayList<String>();
  rawValueList.add(mimeType);
  final List<String> columnNameList;
  if (!sAllowedAndroidPropertySet.contains(mimeType)) {
    return;
  }
  for (int i=1; i <= VCardConstants.MAX_DATA_COLUMN; i++) {
    String value=contentValues.getAsString("String_Node_Str" + i);
    if (value == null) {
      value="String_Node_Str";
    }
    rawValueList.add(value);
  }
  appendLineWithCharsetAndQPDetection(VCardConstants.PROPERTY_X_ANDROID_CUSTOM,rawValueList);
}

Fixed version (ground truth):
public void appendAndroidSpecificProperty(final String mimeType,ContentValues contentValues){
  if (!sAllowedAndroidPropertySet.contains(mimeType)) {
    return;
  }
  final List<String> rawValueList=new ArrayList<String>();
  for (int i=1; i <= VCardConstants.MAX_DATA_COLUMN; i++) {
    String value=contentValues.getAsString("String_Node_Str" + i);
    if (value == null) {
      value="String_Node_Str";
    }
    rawValueList.add(value);
  }
  boolean needCharset=(mShouldAppendCharsetParam && !VCardUtils.containsOnlyNonCrLfPrintableAscii(rawValueList));
  boolean reallyUseQuotedPrintable=(mShouldUseQuotedPrintable && !VCardUtils.containsOnlyNonCrLfPrintableAscii(rawValueList));
  mBuilder.append(VCardConstants.PROPERTY_X_ANDROID_CUSTOM);
  if (needCharset) {
    mBuilder.append(VCARD_PARAM_SEPARATOR);
    mBuilder.append(mVCardCharsetParameter);
  }
  if (reallyUseQuotedPrintable) {
    mBuilder.append(VCARD_PARAM_SEPARATOR);
    mBuilder.append(VCARD_PARAM_ENCODING_QP);
  }
  mBuilder.append(VCARD_DATA_SEPARATOR);
  mBuilder.append(mimeType);
  for (  String rawValue : rawValueList) {
    final String encodedValue;
    if (reallyUseQuotedPrintable) {
      encodedValue=encodeQuotedPrintable(rawValue);
    }
 else {
      encodedValue=escapeCharacters(rawValue);
    }
    mBuilder.append(VCARD_ITEM_SEPARATOR);
    mBuilder.append(encodedValue);
  }
  mBuilder.append(VCARD_END_OF_LINE);
}
Program: 23414
Project: 23414
Buggy source:
public void appendLine(final String propertyName,final List<String> parameterList,final List<String> rawValueList,final boolean needCharset,final boolean needQuotedPrintable){
  mBuilder.append(propertyName);
  if (parameterList != null && parameterList.size() > 0) {
    mBuilder.append(VCARD_PARAM_SEPARATOR);
    appendTypeParameters(parameterList);
  }
  if (needCharset) {
    mBuilder.append(VCARD_PARAM_SEPARATOR);
    mBuilder.append(mVCardCharsetParameter);
  }
  mBuilder.append(VCARD_DATA_SEPARATOR);
  boolean first=true;
  for (  String rawValue : rawValueList) {
    final String encodedValue;
    if (needQuotedPrintable) {
      mBuilder.append(VCARD_PARAM_SEPARATOR);
      mBuilder.append(VCARD_PARAM_ENCODING_QP);
      encodedValue=encodeQuotedPrintable(rawValue);
    }
 else {
      encodedValue=escapeCharacters(rawValue);
    }
    if (first) {
      first=false;
    }
 else {
      mBuilder.append(VCARD_ITEM_SEPARATOR);
    }
    mBuilder.append(encodedValue);
  }
  mBuilder.append(VCARD_END_OF_LINE);
}

Fixed version (ground truth):
public void appendLine(final String propertyName,final List<String> parameterList,final List<String> rawValueList,final boolean needCharset,final boolean needQuotedPrintable){
  mBuilder.append(propertyName);
  if (parameterList != null && parameterList.size() > 0) {
    mBuilder.append(VCARD_PARAM_SEPARATOR);
    appendTypeParameters(parameterList);
  }
  if (needCharset) {
    mBuilder.append(VCARD_PARAM_SEPARATOR);
    mBuilder.append(mVCardCharsetParameter);
  }
  if (needQuotedPrintable) {
    mBuilder.append(VCARD_PARAM_SEPARATOR);
    mBuilder.append(VCARD_PARAM_ENCODING_QP);
  }
  mBuilder.append(VCARD_DATA_SEPARATOR);
  boolean first=true;
  for (  String rawValue : rawValueList) {
    final String encodedValue;
    if (needQuotedPrintable) {
      encodedValue=encodeQuotedPrintable(rawValue);
    }
 else {
      encodedValue=escapeCharacters(rawValue);
    }
    if (first) {
      first=false;
    }
 else {
      mBuilder.append(VCARD_ITEM_SEPARATOR);
    }
    mBuilder.append(encodedValue);
  }
  mBuilder.append(VCARD_END_OF_LINE);
}
Program: 23415
Project: 23415
Buggy source:
public void appendLineWithCharsetAndQPDetection(final String propertyName,final List<String> parameterList,final List<String> rawValueList){
  boolean needCharset=false;
  boolean reallyUseQuotedPrintable=false;
  for (  String rawValue : rawValueList) {
    if (!needCharset && mShouldUseQuotedPrintable && !VCardUtils.containsOnlyPrintableAscii(rawValue)) {
      needCharset=true;
    }
    if (!reallyUseQuotedPrintable && !VCardUtils.containsOnlyNonCrLfPrintableAscii(rawValue)) {
      reallyUseQuotedPrintable=true;
    }
    if (needCharset && reallyUseQuotedPrintable) {
      break;
    }
  }
  appendLine(propertyName,parameterList,rawValueList,needCharset,reallyUseQuotedPrintable);
}

Fixed version (ground truth):
public void appendLineWithCharsetAndQPDetection(final String propertyName,final List<String> parameterList,final List<String> rawValueList){
  boolean needCharset=(mShouldAppendCharsetParam && !VCardUtils.containsOnlyNonCrLfPrintableAscii(rawValueList));
  boolean reallyUseQuotedPrintable=(mShouldUseQuotedPrintable && !VCardUtils.containsOnlyNonCrLfPrintableAscii(rawValueList));
  appendLine(propertyName,parameterList,rawValueList,needCharset,reallyUseQuotedPrintable);
}
Program: 23416
Project: 23416
Buggy source:
/** 
 * TODO: Merge detector and parser mode.
 */
public VCardParser_V21(int parseType){
  super(parseType);
  if (parseType == VCardConfig.PARSE_TYPE_FOMA) {
    mNestCount=1;
  }
}

Fixed version (ground truth):
public VCardParser_V21(int parseType){
  super(parseType);
  if (parseType == VCardConfig.PARSE_TYPE_FOMA) {
    mNestCount=1;
  }
}
Program: 23417
Project: 23417
Buggy source:
public static boolean containsOnlyPrintableAscii(final String... values){
  if (values == null) {
    return true;
  }
  final int asciiFirst=0x20;
  final int asciiLast=0x7E;
  for (  final String value : values) {
    if (TextUtils.isEmpty(value)) {
      continue;
    }
    final int length=value.length();
    for (int i=0; i < length; i=value.offsetByCodePoints(i,1)) {
      final int c=value.codePointAt(i);
      if (!((asciiFirst <= c && c <= asciiLast) || c == '\r' || c == '\n')) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
public static boolean containsOnlyPrintableAscii(final Collection<String> values){
  if (values == null) {
    return true;
  }
  final int asciiFirst=0x20;
  final int asciiLast=0x7E;
  for (  final String value : values) {
    if (TextUtils.isEmpty(value)) {
      continue;
    }
    final int length=value.length();
    for (int i=0; i < length; i=value.offsetByCodePoints(i,1)) {
      final int c=value.codePointAt(i);
      if (!((asciiFirst <= c && c <= asciiLast) || c == '\r' || c == '\n')) {
        return false;
      }
    }
  }
  return true;
}
Program: 23418
Project: 23418
Buggy source:
/** 
 * This is useful since vCard 3.0 often requires the ("X-") properties and groups should contain only alphabets, digits, and hyphen. Note: It is already known some devices (wrongly) outputs properties with characters which should not be in the field. One example is "X-GOOGLE TALK". We accept such kind of input but must never output it unless the target is very specific to the device which is able to parse the malformed input. 
 */
public static boolean containsOnlyAlphaDigitHyphen(final String... values){
  if (values == null) {
    return true;
  }
  final int upperAlphabetFirst=0x41;
  final int upperAlphabetAfterLast=0x5b;
  final int lowerAlphabetFirst=0x61;
  final int lowerAlphabetAfterLast=0x7b;
  final int digitFirst=0x30;
  final int digitAfterLast=0x3A;
  final int hyphen='-';
  for (  final String str : values) {
    if (TextUtils.isEmpty(str)) {
      continue;
    }
    final int length=str.length();
    for (int i=0; i < length; i=str.offsetByCodePoints(i,1)) {
      int codepoint=str.codePointAt(i);
      if (!((lowerAlphabetFirst <= codepoint && codepoint < lowerAlphabetAfterLast) || (upperAlphabetFirst <= codepoint && codepoint < upperAlphabetAfterLast) || (digitFirst <= codepoint && codepoint < digitAfterLast)|| (codepoint == hyphen))) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
public static boolean containsOnlyAlphaDigitHyphen(final Collection<String> values){
  if (values == null) {
    return true;
  }
  final int upperAlphabetFirst=0x41;
  final int upperAlphabetAfterLast=0x5b;
  final int lowerAlphabetFirst=0x61;
  final int lowerAlphabetAfterLast=0x7b;
  final int digitFirst=0x30;
  final int digitAfterLast=0x3A;
  final int hyphen='-';
  for (  final String str : values) {
    if (TextUtils.isEmpty(str)) {
      continue;
    }
    final int length=str.length();
    for (int i=0; i < length; i=str.offsetByCodePoints(i,1)) {
      int codepoint=str.codePointAt(i);
      if (!((lowerAlphabetFirst <= codepoint && codepoint < lowerAlphabetAfterLast) || (upperAlphabetFirst <= codepoint && codepoint < upperAlphabetAfterLast) || (digitFirst <= codepoint && codepoint < digitAfterLast)|| (codepoint == hyphen))) {
        return false;
      }
    }
  }
  return true;
}
Program: 23419
Project: 23419
Buggy source:
/** 
 * This is useful when checking the string should be encoded into quoted-printable or not, which is required by vCard 2.1. See the definition of "7bit" in vCard 2.1 spec for more information.
 */
public static boolean containsOnlyNonCrLfPrintableAscii(final String... values){
  if (values == null) {
    return true;
  }
  final int asciiFirst=0x20;
  final int asciiLast=0x7E;
  for (  final String value : values) {
    if (TextUtils.isEmpty(value)) {
      continue;
    }
    final int length=value.length();
    for (int i=0; i < length; i=value.offsetByCodePoints(i,1)) {
      final int c=value.codePointAt(i);
      if (!(asciiFirst <= c && c <= asciiLast)) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
public static boolean containsOnlyNonCrLfPrintableAscii(final Collection<String> values){
  if (values == null) {
    return true;
  }
  final int asciiFirst=0x20;
  final int asciiLast=0x7E;
  for (  final String value : values) {
    if (TextUtils.isEmpty(value)) {
      continue;
    }
    final int length=value.length();
    for (int i=0; i < length; i=value.offsetByCodePoints(i,1)) {
      final int c=value.codePointAt(i);
      if (!(asciiFirst <= c && c <= asciiLast)) {
        return false;
      }
    }
  }
  return true;
}
Program: 23420
Project: 23420
Buggy source:
public void testContainsOnlyNonCrLfPrintableAscii(){
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii((String)null));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii((String[])null));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  StringBuilder builder=new StringBuilder();
  for (int i=0x20; i < 0x7F; i++) {
    builder.append((char)i);
  }
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii(builder.toString()));
  assertFalse(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
}

Fixed version (ground truth):
public void testContainsOnlyNonCrLfPrintableAscii(){
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii((String)null));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii((String[])null));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii((List<String>)null));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  StringBuilder builder=new StringBuilder();
  for (int i=0x20; i < 0x7F; i++) {
    builder.append((char)i);
  }
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii(builder.toString()));
  assertFalse(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
}
Program: 23421
Project: 23421
Buggy source:
public void testContainsOnlyAlphaDigitHyphen(){
  assertTrue(VCardUtils.containsOnlyAlphaDigitHyphen((String)null));
  assertTrue(VCardUtils.containsOnlyAlphaDigitHyphen((String[])null));
  assertTrue(VCardUtils.containsOnlyAlphaDigitHyphen("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  for (int i=0; i < 0x30; i++) {
    if (i == 0x2D) {
      continue;
    }
    assertFalse(VCardUtils.containsOnlyAlphaDigitHyphen(String.valueOf((char)i)));
  }
  for (int i=0x3A; i < 0x41; i++) {
    assertFalse(VCardUtils.containsOnlyAlphaDigitHyphen(String.valueOf((char)i)));
  }
  for (int i=0x5B; i < 0x61; i++) {
    assertFalse(VCardUtils.containsOnlyAlphaDigitHyphen(String.valueOf((char)i)));
  }
  for (int i=0x7B; i < 0x100; i++) {
    assertFalse(VCardUtils.containsOnlyAlphaDigitHyphen(String.valueOf((char)i)));
  }
}

Fixed version (ground truth):
public void testContainsOnlyAlphaDigitHyphen(){
  assertTrue(VCardUtils.containsOnlyAlphaDigitHyphen((String)null));
  assertTrue(VCardUtils.containsOnlyAlphaDigitHyphen((String[])null));
  assertTrue(VCardUtils.containsOnlyAlphaDigitHyphen((List<String>)null));
  assertTrue(VCardUtils.containsOnlyAlphaDigitHyphen("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  for (int i=0; i < 0x30; i++) {
    if (i == 0x2D) {
      continue;
    }
    assertFalse(VCardUtils.containsOnlyAlphaDigitHyphen(String.valueOf((char)i)));
  }
  for (int i=0x3A; i < 0x41; i++) {
    assertFalse(VCardUtils.containsOnlyAlphaDigitHyphen(String.valueOf((char)i)));
  }
  for (int i=0x5B; i < 0x61; i++) {
    assertFalse(VCardUtils.containsOnlyAlphaDigitHyphen(String.valueOf((char)i)));
  }
  for (int i=0x7B; i < 0x100; i++) {
    assertFalse(VCardUtils.containsOnlyAlphaDigitHyphen(String.valueOf((char)i)));
  }
}
Program: 23422
Project: 23422
Buggy source:
public void testContainsOnlyPrintableAscii(){
  assertTrue(VCardUtils.containsOnlyPrintableAscii((String)null));
  assertTrue(VCardUtils.containsOnlyPrintableAscii((String[])null));
  assertTrue(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  StringBuilder builder=new StringBuilder();
  for (int i=0x20; i < 0x7F; i++) {
    builder.append((char)i);
  }
  assertTrue(VCardUtils.containsOnlyPrintableAscii(builder.toString()));
  assertTrue(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
}

Fixed version (ground truth):
public void testContainsOnlyPrintableAscii(){
  assertTrue(VCardUtils.containsOnlyPrintableAscii((String)null));
  assertTrue(VCardUtils.containsOnlyPrintableAscii((String[])null));
  assertTrue(VCardUtils.containsOnlyPrintableAscii((List<String>)null));
  assertTrue(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  StringBuilder builder=new StringBuilder();
  for (int i=0x20; i < 0x7F; i++) {
    builder.append((char)i);
  }
  assertTrue(VCardUtils.containsOnlyPrintableAscii(builder.toString()));
  assertTrue(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
}
Program: 23423
Project: 23423
Buggy source:
public void screenOnStoppedLw(){
  if (!mKeyguardMediator.isShowing() && mPowerManager.isScreenOn()) {
    long curTime=SystemClock.uptimeMillis();
    mPowerManager.userActivity(curTime,false,LocalPowerManager.OTHER_EVENT);
  }
}

Fixed version (ground truth):
public void screenOnStoppedLw(){
  if (!mKeyguardMediator.isShowingAndNotHidden() && mPowerManager.isScreenOn()) {
    long curTime=SystemClock.uptimeMillis();
    mPowerManager.userActivity(curTime,false,LocalPowerManager.OTHER_EVENT);
  }
}
Program: 23424
Project: 23424
Buggy source:
/** 
 * {@inheritDoc} 
 */
public boolean keyguardIsShowingTq(){
  return mKeyguardMediator.isShowing();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public boolean keyguardIsShowingTq(){
  return mKeyguardMediator.isShowingAndNotHidden();
}
Program: 23425
Project: 23425
Buggy source:
void showGlobalActionsDialog(){
  if (mGlobalActions == null) {
    mGlobalActions=new GlobalActions(mContext);
  }
  final boolean keyguardShowing=mKeyguardMediator.isShowing();
  mGlobalActions.showDialog(keyguardShowing,isDeviceProvisioned());
  if (keyguardShowing) {
    mKeyguardMediator.pokeWakelock();
  }
}

Fixed version (ground truth):
void showGlobalActionsDialog(){
  if (mGlobalActions == null) {
    mGlobalActions=new GlobalActions(mContext);
  }
  final boolean keyguardShowing=mKeyguardMediator.isShowingAndNotHidden();
  mGlobalActions.showDialog(keyguardShowing,isDeviceProvisioned());
  if (keyguardShowing) {
    mKeyguardMediator.pokeWakelock();
  }
}
Program: 23426
Project: 23426
Buggy source:
public boolean performHapticFeedbackLw(WindowState win,int effectId,boolean always){
  final boolean hapticsDisabled=Settings.System.getInt(mContext.getContentResolver(),Settings.System.HAPTIC_FEEDBACK_ENABLED,0) == 0;
  if (!always && (hapticsDisabled || mKeyguardMediator.isShowing())) {
    return false;
  }
switch (effectId) {
case HapticFeedbackConstants.LONG_PRESS:
    mVibrator.vibrate(mLongPressVibePattern,-1);
  return true;
case HapticFeedbackConstants.VIRTUAL_KEY:
mVibrator.vibrate(mVirtualKeyVibePattern,-1);
return true;
case HapticFeedbackConstants.SAFE_MODE_DISABLED:
mVibrator.vibrate(mSafeModeDisabledVibePattern,-1);
return true;
case HapticFeedbackConstants.SAFE_MODE_ENABLED:
mVibrator.vibrate(mSafeModeEnabledVibePattern,-1);
return true;
}
return false;
}

Fixed version (ground truth):
public boolean performHapticFeedbackLw(WindowState win,int effectId,boolean always){
  final boolean hapticsDisabled=Settings.System.getInt(mContext.getContentResolver(),Settings.System.HAPTIC_FEEDBACK_ENABLED,0) == 0;
  if (!always && (hapticsDisabled || mKeyguardMediator.isShowingAndNotHidden())) {
    return false;
  }
switch (effectId) {
case HapticFeedbackConstants.LONG_PRESS:
    mVibrator.vibrate(mLongPressVibePattern,-1);
  return true;
case HapticFeedbackConstants.VIRTUAL_KEY:
mVibrator.vibrate(mVirtualKeyVibePattern,-1);
return true;
case HapticFeedbackConstants.SAFE_MODE_DISABLED:
mVibrator.vibrate(mSafeModeDisabledVibePattern,-1);
return true;
case HapticFeedbackConstants.SAFE_MODE_ENABLED:
mVibrator.vibrate(mSafeModeEnabledVibePattern,-1);
return true;
}
return false;
}