Program: 26494
Project: 26494
Buggy source:
@Override public void run(){
  Log.w("String_Node_Str","String_Node_Str" + symbol);
switch (symbol) {
case TerminalIO.DEL:
case TerminalIO.DELETE:
case TerminalIO.BACKSPACE:
{
      myService.sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
      break;
    }
case TerminalIO.ENTER:
case '\n':
{
    myService.sendDownUpKeyEvents(KeyEvent.KEYCODE_ENTER);
    break;
  }
case TerminalIO.LEFT:
{
  myService.sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_LEFT);
  break;
}
case TerminalIO.RIGHT:
{
myService.sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_RIGHT);
break;
}
case TerminalIO.UP:
{
myService.sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_UP);
break;
}
case TerminalIO.DOWN:
{
myService.sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_DOWN);
break;
}
case TerminalIO.ESCAPE:
{
myService.sendDownUpKeyEvents(KeyEvent.KEYCODE_BACK);
break;
}
case TerminalIO.TABULATOR:
{
myService.sendDownUpKeyEvents(KeyEvent.KEYCODE_TAB);
break;
}
default :
{
InputConnection inputConnection=myService.getCurrentInputConnection();
if (inputConnection != null) {
inputConnection.commitText(new String(sequence),1);
}
}
}
inUse=false;
}

Fixed version (ground truth):
public void run(){
  Log.w("String_Node_Str","String_Node_Str" + symbol);
  InputConnection con=myService.getCurrentInputConnection();
  if (con == null) {
    return;
  }
switch (symbol) {
case TerminalIO.DEL:
case TerminalIO.DELETE:
case TerminalIO.BACKSPACE:
{
      con.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_DEL));
      con.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP,KeyEvent.KEYCODE_DEL));
      break;
    }
case TerminalIO.ENTER:
case '\n':
{
    con.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_ENTER));
    con.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP,KeyEvent.KEYCODE_ENTER));
    break;
  }
case TerminalIO.LEFT:
{
  con.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_DPAD_LEFT));
  con.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP,KeyEvent.KEYCODE_DPAD_LEFT));
  break;
}
case TerminalIO.RIGHT:
{
con.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_DPAD_RIGHT));
con.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP,KeyEvent.KEYCODE_DPAD_RIGHT));
break;
}
case TerminalIO.UP:
{
con.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_DPAD_UP));
con.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP,KeyEvent.KEYCODE_DPAD_UP));
break;
}
case TerminalIO.DOWN:
{
con.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_DPAD_DOWN));
con.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP,KeyEvent.KEYCODE_DPAD_DOWN));
break;
}
case TerminalIO.ESCAPE:
{
con.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_BACK));
con.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP,KeyEvent.KEYCODE_BACK));
break;
}
case TerminalIO.TABULATOR:
{
con.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_TAB));
con.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP,KeyEvent.KEYCODE_TAB));
break;
}
case TerminalIO.COLORINIT:
{
ExtractedText text=con.getExtractedText(new ExtractedTextRequest(),0);
try {
con.setSelection(0,text.text.length());
}
 catch (NullPointerException e) {
}
break;
}
case 3:
{
con.performContextMenuAction(android.R.id.copy);
break;
}
case 22:
{
con.performContextMenuAction(android.R.id.paste);
break;
}
case 24:
{
con.performContextMenuAction(android.R.id.cut);
break;
}
default :
{
con.commitText(new String(sequence),1);
}
}
}