nus-yam/ex-repair huggingface dataset:
Program: 45303
Project: 45303
Buggy source:
@Override public void update(float deltaTime){
  int len;
  List<TouchEvent> touchEvents=game.getInput().getTouchEvents();
  List<KeyEvent> keyEvents=game.getInput().getKeyEvents();
  len=keyEvents.size();
  for (int i=0; i < len; i++) {
    KeyEvent kevent=keyEvents.get(i);
    if (kevent.keyCode == android.view.KeyEvent.KEYCODE_BACK && kevent.type == kevent.KEY_UP)     screenNumber--;
    if (screenNumber < 1)     game.setScreen(new MainMenuScreen(game));
  }
  Graphics g=game.getGraphics();
  len=touchEvents.size();
  for (int i=0; i < len; i++) {
    TouchEvent event=touchEvents.get(i);
    if (event.type == TouchEvent.TOUCH_UP) {
      if (event.x > g.getWidth() - Assets.BUTTON_WIDTH && event.y > g.getHeight() - Assets.BUTTON_HEIGHT) {
        screenNumber++;
        if (screenNumber > 3) {
          game.setScreen(new MainMenuScreen(game));
        }
        if (Settings.soundEnabled)         Assets.click.play(1);
        return;
      }
      if (event.x < Assets.BUTTON_WIDTH && event.y > g.getHeight() - Assets.BUTTON_HEIGHT) {
        screenNumber--;
        if (screenNumber < 1) {
          game.setScreen(new MainMenuScreen(game));
        }
        if (Settings.soundEnabled)         Assets.click.play(1);
        return;
      }
    }
  }
}

Fixed version (ground truth):
@Override public void update(float deltaTime){
  int len;
  List<TouchEvent> touchEvents=game.getInput().getTouchEvents();
  List<KeyEvent> keyEvents=game.getInput().getKeyEvents();
  len=keyEvents.size();
  for (int i=0; i < len; i++) {
    KeyEvent kevent=keyEvents.get(i);
    if (kevent.keyCode == android.view.KeyEvent.KEYCODE_BACK && kevent.type == KeyEvent.KEY_UP)     game.setScreen(new MainMenuScreen(game));
  }
  Graphics g=game.getGraphics();
  len=touchEvents.size();
  for (int i=0; i < len; i++) {
    TouchEvent event=touchEvents.get(i);
    if (event.type == TouchEvent.TOUCH_UP) {
      if (event.x > g.getWidth() - Assets.BUTTON_WIDTH && event.y > g.getHeight() - Assets.BUTTON_HEIGHT) {
        screenNumber++;
        if (screenNumber > 3) {
          game.setScreen(new MainMenuScreen(game));
        }
        if (Settings.soundEnabled)         Assets.click.play(1);
        return;
      }
      if (event.x < Assets.BUTTON_WIDTH && event.y > g.getHeight() - Assets.BUTTON_HEIGHT) {
        screenNumber--;
        if (screenNumber < 1) {
          game.setScreen(new MainMenuScreen(game));
        }
        if (Settings.soundEnabled)         Assets.click.play(1);
        return;
      }
    }
  }
}
Program: 45304
Project: 45304
Buggy source:
@Override public void update(float deltaTime){
  int len;
  List<TouchEvent> touchEvents=game.getInput().getTouchEvents();
  List<KeyEvent> keyEvents=game.getInput().getKeyEvents();
  len=keyEvents.size();
  for (int i=0; i < len; i++) {
    KeyEvent kevent=keyEvents.get(i);
    if (kevent.keyCode == android.view.KeyEvent.KEYCODE_BACK && kevent.type == kevent.KEY_UP)     game.setScreen(new MainMenuScreen(game));
  }
  Graphics g=game.getGraphics();
  len=touchEvents.size();
  for (int i=0; i < len; i++) {
    TouchEvent event=touchEvents.get(i);
    if (event.type == TouchEvent.TOUCH_UP) {
      if (event.x < Assets.BUTTON_WIDTH && event.y > g.getHeight() - Assets.BUTTON_HEIGHT) {
        if (Settings.soundEnabled)         Assets.click.play(1);
        game.setScreen(new MainMenuScreen(game));
        return;
      }
    }
  }
}

Fixed version (ground truth):
@Override public void update(float deltaTime){
  int len;
  List<TouchEvent> touchEvents=game.getInput().getTouchEvents();
  List<KeyEvent> keyEvents=game.getInput().getKeyEvents();
  len=keyEvents.size();
  for (int i=0; i < len; i++) {
    KeyEvent kevent=keyEvents.get(i);
    if (kevent.keyCode == android.view.KeyEvent.KEYCODE_BACK && kevent.type == KeyEvent.KEY_UP)     game.setScreen(new MainMenuScreen(game));
  }
  Graphics g=game.getGraphics();
  len=touchEvents.size();
  for (int i=0; i < len; i++) {
    TouchEvent event=touchEvents.get(i);
    if (event.type == TouchEvent.TOUCH_UP) {
      if (event.x < Assets.BUTTON_WIDTH && event.y > g.getHeight() - Assets.BUTTON_HEIGHT) {
        if (Settings.soundEnabled)         Assets.click.play(1);
        game.setScreen(new MainMenuScreen(game));
        return;
      }
    }
  }
}
Program: 45306
Project: 45306
Buggy source:
@Override public void update(float deltaTime){
  int len;
  List<TouchEvent> events=game.getInput().getTouchEvents();
  List<KeyEvent> keyEvents=game.getInput().getKeyEvents();
  len=keyEvents.size();
  for (int i=0; i < len; i++) {
    KeyEvent kevent=keyEvents.get(i);
    if (kevent.keyCode == android.view.KeyEvent.KEYCODE_BACK && kevent.type == kevent.KEY_UP)     game.setScreen(new MainMenuScreen(game));
  }
  Graphics g=game.getGraphics();
  len=events.size();
  for (int i=0; i < len; i++) {
    TouchEvent event=events.get(i);
    if (event.type == TouchEvent.TOUCH_UP) {
      if (event.x < Assets.BUTTON_WIDTH && event.y > g.getHeight() - Assets.BUTTON_HEIGHT) {
        if (Settings.soundEnabled)         Assets.click.play(1);
        game.setScreen(new MainMenuScreen(game));
        return;
      }
    }
    int y=g.getHeight() / 2;
    for (int j=1; j <= 5; j++) {
      if (event.type == TouchEvent.TOUCH_UP) {
        int x=j * (g.getWidth() - 30) / 5 - Assets.NUMBER_WIDTH;
        if (event.x > x && event.x < x + Assets.NUMBER_WIDTH && event.y > y && event.y < y + Assets.NUMBER_HEIGHT) {
          if (Settings.soundEnabled)           Assets.click.play(1);
          Settings.gameSpeed=j;
          return;
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void update(float deltaTime){
  int len;
  List<TouchEvent> events=game.getInput().getTouchEvents();
  List<KeyEvent> keyEvents=game.getInput().getKeyEvents();
  len=keyEvents.size();
  for (int i=0; i < len; i++) {
    KeyEvent kevent=keyEvents.get(i);
    if (kevent.keyCode == android.view.KeyEvent.KEYCODE_BACK && kevent.type == KeyEvent.KEY_UP)     game.setScreen(new MainMenuScreen(game));
  }
  Graphics g=game.getGraphics();
  len=events.size();
  for (int i=0; i < len; i++) {
    TouchEvent event=events.get(i);
    if (event.type == TouchEvent.TOUCH_UP) {
      if (event.x < Assets.BUTTON_WIDTH && event.y > g.getHeight() - Assets.BUTTON_HEIGHT) {
        if (Settings.soundEnabled)         Assets.click.play(1);
        game.setScreen(new MainMenuScreen(game));
        return;
      }
    }
    int y=g.getHeight() / 2;
    for (int j=1; j <= 5; j++) {
      if (event.type == TouchEvent.TOUCH_UP) {
        int x=j * (g.getWidth() - 30) / 5 - Assets.NUMBER_WIDTH;
        if (event.x > x && event.x < x + Assets.NUMBER_WIDTH && event.y > y && event.y < y + Assets.NUMBER_HEIGHT) {
          if (Settings.soundEnabled)           Assets.click.play(1);
          Settings.gameSpeed=j;
          return;
        }
      }
    }
  }
}
Program: 45307
Project: 45307
Buggy source:
private void updateReady(List<TouchEvent> touchEvents){
  if (touchEvents.size() > 0)   state=GameState.Running;
}

Fixed version (ground truth):
private void updateReady(List<TouchEvent> touchEvents){
  if (touchEvents.size() > 0) {
    state=GameState.Running;
    World.tick=World.TICK_INITIAL;
  }
}
Program: 45308
Project: 45308
Buggy source:
public void eat(){
  SnakePart end=parts.get(parts.size() - 1);
  parts.add(new SnakePart(end.x,end.y));
}

Fixed version (ground truth):
public void eat(){
  Log.e("String_Node_Str","String_Node_Str" + World.tick);
  SnakePart end=parts.get(parts.size() - 1);
  parts.add(new SnakePart(end.x,end.y));
}
Program: 45309
Project: 45309
Buggy source:
public void update(float deltaTime){
  if (gameOver)   return;
  tickTime+=deltaTime;
  while (tickTime > tick) {
    tickTime-=tick;
    snake.advance();
    if (snake.checkBitten()) {
      gameOver=true;
      return;
    }
    SnakePart head=snake.parts.get(0);
    if (head.x == stain.x && head.y == stain.y) {
      score+=SCORE_INCREMENT;
      stainsEaten++;
      snake.eat();
      if (snake.parts.size() == WORLD_WIDTH * WORLD_HEIGHT) {
        gameOver=true;
        return;
      }
 else {
        placeStain();
      }
      if (score % 100 == 0 && tick - TICK_DECREMENT > 0) {
        tick-=TICK_DECREMENT;
      }
    }
    if (extraStain != null) {
      if (head.x == extraStain.x && head.y == extraStain.y) {
        snake.shrink();
        extraStain=null;
      }
      if (deltaTick >= 20) {
        extraStain=null;
        deltaTick=0;
      }
 else {
        deltaTick++;
      }
    }
  }
}

Fixed version (ground truth):
public void update(float deltaTime){
  if (gameOver)   return;
  tickTime+=deltaTime;
  while (tickTime > tick) {
    tickTime-=tick;
    snake.advance();
    if (snake.checkBitten()) {
      gameOver=true;
      return;
    }
    SnakePart head=snake.parts.get(0);
    if (head.x == stain.x && head.y == stain.y) {
      score+=SCORE_INCREMENT;
      stainsEaten++;
      snake.eat();
      if (snake.parts.size() == WORLD_WIDTH * WORLD_HEIGHT) {
        gameOver=true;
        return;
      }
 else {
        placeStain();
      }
      if (score % 100 == 0 && tick - TICK_DECREMENT > 0) {
        tick-=TICK_DECREMENT;
      }
    }
    if (extraStain != null) {
      if (head.x == extraStain.x && head.y == extraStain.y) {
        score+=5 * SCORE_INCREMENT;
        snake.shrink();
        extraStain=null;
        deltaTick=0;
      }
 else {
        if (deltaTick >= 20) {
          extraStain=null;
          deltaTick=0;
        }
 else {
          deltaTick++;
        }
      }
    }
  }
}
Program: 45310
Project: 45310
Buggy source:
/** 
 * <p> Disables the connection until new connection constants are provided. </p> <p> Precondition: None <br /> Postcondition: The connection is disabled and subsequent calls to Connection.connect() or Connection.submitRequest() will throw exceptions. </p>
 * @return Boolean if the API key and Secret are valid for the providedserver then true is returned else false is returned
 * @throws ConnectionDisabled The connection must be enabled by calling Connection.setConnectionConstants.
 */
public static void disable(){
  Connection.enabled=false;
}

Fixed version (ground truth):
/** 
 * <p> Disables the connection until new connection constants are provided. </p> <p> Precondition: None <br /> Postcondition: The connection is disabled and subsequent calls to Connection.connect() or Connection.submitRequest() will throw exceptions. </p>
 * @throws ConnectionDisabled The connection must be enabled by calling Connection.setConnectionConstants.
 */
public static void disable(){
  Connection.enabled=false;
}
Program: 45311
Project: 45311
Buggy source:
/** 
 * <p> Finds persistent resource data within the Cashier system. </p> <p> Precondition: The connection must be enabled otherwise a  ConnectionDisabledExcepiton will be thrown.<br /> Postcondition: If a resource is found matching the unique id  provided then a singular resource will be returned else null will be returned. </p>
 * @param id the unique id of the item to be found.
 * @param resource the cashier resource being utilized in the search.
 * @param table the cashier table being utilized in the search.
 * @return Resource singular Cashier resource that matches the id provided, a resource or if nothing is found will be null.
 * @throws ConnectionDisabledException 
 */
public Response submit() throws ProtocolException, ConnectionDisabledException, InvalidRequestException {
  if (this.isValid()) {
    return Connection.submitRequest(this);
  }
 else {
    throw new InvalidRequestException(this);
  }
}

Fixed version (ground truth):
/** 
 * <p> Finds persistent resource data within the Cashier system. </p> <p> Precondition: The connection must be enabled otherwise a  ConnectionDisabledExcepiton will be thrown.<br /> Postcondition: If a resource is found matching the unique id  provided then a singular resource will be returned else null will be returned. </p>
 * @return Response returns the Cashier Response object generated by this request.
 * @throws ConnectionDisabledException 
 */
public Response submit() throws ProtocolException, ConnectionDisabledException, InvalidRequestException {
  if (this.isValid()) {
    return Connection.submitRequest(this);
  }
 else {
    throw new InvalidRequestException(this);
  }
}
Program: 45312
Project: 45312
Buggy source:
@Override public void tick(){
  if (this.state == State.RUNNING) {
    if (!this.board.full()) {
      if (this.initCounter > 0) {
        this.fillZigZag();
      }
 else {
      }
    }
    this.board.updateBoard();
  }
}

Fixed version (ground truth):
@Override public void tick(){
  if (this.state == State.RUNNING) {
    if (!this.board.full()) {
      if (this.initCounter > 0) {
        this.fillZigZag();
      }
 else {
        int boardWidth=this.board.getBoardWidth();
        int boardHeight=this.board.getBoardHeight();
        for (int x=boardWidth - 1; x >= 0; x--) {
          for (int y=boardHeight - 1; y >= 0; y--) {
            if (this.board.getBlockAt(x,y) == null) {
              this.addRandom(x,y);
            }
          }
        }
      }
    }
    this.board.updateBoard();
  }
}
Program: 45313
Project: 45313
Buggy source:
public void addRandom(int x,int y){
  int type;
  if (y < this.board.getBoardHeight() - 1) {
    type=this.getRandomBlockType();
    while (this.board.getBlockAt(x,y + 1) != null && this.board.getBlockAt(x,y + 1).getType() == type) {
      type=this.getRandomBlockType();
    }
  }
 else {
    type=this.getRandomBlockType();
  }
  this.createBlock(x,y,type);
}

Fixed version (ground truth):
public void addRandom(int x,int y){
  int type;
  if (y < this.board.getBoardHeight() * 2 - 1) {
    type=this.getRandomBlockType();
    while (this.board.getBlockAt(x,y + 1) != null && this.board.getBlockAt(x,y + 1).getType() == type) {
      type=this.getRandomBlockType();
    }
  }
 else {
    type=this.getRandomBlockType();
  }
  this.createBlock(x,y,type);
}
Program: 45315
Project: 45315
Buggy source:
/** 
 * Prints encoding error messages.
 * @param lexer Lexer
 * @param code error code
 * @param c invalid char
 */
public void encodingError(Lexer lexer,ErrorCode code,int c,int replaceMode){
  if (lexer.errors > lexer.configuration.getShowErrors()) {
    return;
  }
  if (lexer.configuration.isShowWarnings()) {
    String buf=Integer.toHexString(c);
switch (code) {
case ENCODING_MISMATCH:
      lexer.badChars|=BC_ENCODING_MISMATCH;
    messageLexer(code.code(),lexer,Level.WARNING,"String_Node_Str",lexer.configuration.getInCharEncodingName(),ParsePropertyImpl.CHAR_ENCODING.getFriendlyName(null,new Integer(c),lexer.configuration));
  break;
case VENDOR_SPECIFIC_CHARS:
lexer.badChars|=BC_VENDOR_SPECIFIC_CHARS;
messageLexer(code.code(),lexer,Level.WARNING,"String_Node_Str",replaceMode,buf);
break;
case INVALID_SGML_CHARS:
lexer.badChars|=BC_INVALID_SGML_CHARS;
messageLexer(code.code(),lexer,Level.WARNING,"String_Node_Str",replaceMode,buf);
break;
case INVALID_UTF8:
lexer.badChars|=BC_INVALID_UTF8;
messageLexer(lexer,Level.WARNING,code,replaceMode,buf);
break;
case INVALID_UTF16:
lexer.badChars|=BC_INVALID_UTF16;
messageLexer(lexer,Level.WARNING,code,replaceMode,buf);
break;
case INVALID_NCR:
lexer.badChars|=BC_INVALID_NCR;
messageLexer(lexer,Level.WARNING,code,replaceMode,c);
break;
}
}
}

Fixed version (ground truth):
/** 
 * Prints encoding error messages.
 * @param lexer Lexer
 * @param code error code
 * @param c invalid char
 */
public void encodingError(Lexer lexer,ErrorCode code,int c,int replaceMode){
  if (lexer.errors > lexer.configuration.getShowErrors()) {
    return;
  }
  if (lexer.configuration.isShowWarnings()) {
    String buf=Integer.toHexString(c);
switch (code) {
case ENCODING_MISMATCH:
      lexer.badChars|=BC_ENCODING_MISMATCH;
    messageLexer(code.code(),lexer,Level.WARNING,"String_Node_Str",lexer.configuration.getInCharEncodingName(),ParsePropertyImpl.CHAR_ENCODING.getFriendlyName(null,new Integer(c),lexer.configuration));
  break;
case VENDOR_SPECIFIC_CHARS:
lexer.badChars|=BC_VENDOR_SPECIFIC_CHARS;
messageLexer(code.code(),lexer,Level.WARNING,"String_Node_Str",replaceMode,c);
break;
case INVALID_SGML_CHARS:
lexer.badChars|=BC_INVALID_SGML_CHARS;
messageLexer(code.code(),lexer,Level.WARNING,"String_Node_Str",replaceMode,c);
break;
case INVALID_UTF8:
lexer.badChars|=BC_INVALID_UTF8;
messageLexer(lexer,Level.WARNING,code,replaceMode,buf);
break;
case INVALID_UTF16:
lexer.badChars|=BC_INVALID_UTF16;
messageLexer(lexer,Level.WARNING,code,replaceMode,buf);
break;
case INVALID_NCR:
lexer.badChars|=BC_INVALID_NCR;
messageLexer(lexer,Level.WARNING,code,replaceMode,c);
break;
}
}
}
Program: 45316
Project: 45316
Buggy source:
/** 
 * @see org.w3c.tidy.StreamIn#setLexer(org.w3c.tidy.Lexer)
 */
public void setLexer(Lexer lexer){
}

Fixed version (ground truth):
/** 
 * @see org.w3c.tidy.StreamIn#setLexer(org.w3c.tidy.Lexer)
 */
public void setLexer(final Lexer lexer){
  this.lexer=lexer;
}
Program: 45317
Project: 45317
Buggy source:
/** 
 * @see org.w3c.tidy.StreamIn#readChar()
 */
public int readChar(){
  int c=END_OF_STREAM;
  if (this.pushed) {
    return popChar();
  }
  saveLastPos();
  if (this.tabs > 0) {
    this.curcol++;
    this.tabs--;
    return ' ';
  }
  c=readCharFromStream();
  if (END_OF_STREAM == c) {
    endOfStream=true;
    return END_OF_STREAM;
  }
  if (c == '\n') {
    this.curcol=1;
    this.curline++;
    return c;
  }
  if (c == '\t') {
    this.tabs=tabsize > 0 ? this.tabsize - ((this.curcol - 1) % this.tabsize) - 1 : 0;
    this.curcol++;
    c=' ';
    return c;
  }
  if (c == '\r') {
    c=readCharFromStream();
    if (c != '\n') {
      if (c != END_OF_STREAM) {
        ungetChar(c);
      }
      c='\n';
    }
 else {
      this.curcol=1;
      this.curline++;
      return c;
    }
  }
  this.curcol++;
  return c;
}

Fixed version (ground truth):
/** 
 * @see org.w3c.tidy.StreamIn#readChar()
 */
public int readChar(){
  int c=END_OF_STREAM;
  if (this.pushed) {
    return popChar();
  }
  saveLastPos();
  if (this.tabs > 0) {
    this.curcol++;
    this.tabs--;
    return ' ';
  }
  c=readCharFromStream();
  if (END_OF_STREAM == c) {
    endOfStream=true;
    return END_OF_STREAM;
  }
  if (c == '\n') {
    this.curcol=1;
    this.curline++;
    return c;
  }
  if (c == '\t') {
    this.tabs=tabsize > 0 ? this.tabsize - ((this.curcol - 1) % this.tabsize) - 1 : 0;
    this.curcol++;
    c=' ';
    return c;
  }
  if (c == '\r') {
    c=readCharFromStream();
    if (c != '\n') {
      if (c != END_OF_STREAM) {
        ungetChar(c);
      }
      c='\n';
    }
 else {
      this.curcol=1;
      this.curline++;
      return c;
    }
  }
  if (127 < c && c < 160) {
    int c1=0;
    int replMode=Report.DISCARDED_CHAR;
    final String enc=lexer.configuration.getInCharEncodingName();
    final String repl=lexer.configuration.getReplacementCharEncoding();
    boolean isVendorChar=("String_Node_Str".equals(enc) || "String_Node_Str".equals(enc));
    boolean isWinChar=("String_Node_Str".equals(enc) || "String_Node_Str".equals(repl));
    boolean isMacChar=("String_Node_Str".equals(enc) || "String_Node_Str".equals(repl));
    lexer.lines=curline;
    lexer.columns=curcol;
    if (isWinChar) {
      c1=EncodingUtils.decodeWin1252(c);
    }
 else     if (isMacChar) {
      c1=EncodingUtils.decodeMacRoman(c);
    }
    if (c1 != 0) {
      replMode=Report.REPLACED_CHAR;
    }
    if (c1 == 0 && isVendorChar) {
      lexer.report.encodingError(lexer,ErrorCode.VENDOR_SPECIFIC_CHARS,c,replMode);
    }
 else     if (!isVendorChar) {
      lexer.report.encodingError(lexer,ErrorCode.INVALID_SGML_CHARS,c,replMode);
    }
    c=c1;
  }
  this.curcol++;
  return c;
}
Program: 45318
Project: 45318
Buggy source:
/** 
 * Symptom: <ul> <li> <ul> ... </ul> </li> </ul> Action: discard outer list.
 * @param lexer Lexer
 * @param node Node
 * @param pnode passed in as array to allow modifications.
 * @return <code>true</code> if nested lists have been found and replaced
 */
private boolean nestedList(Lexer lexer,Node node,Node[] pnode){
  Node child, list;
  if (node.is(TagId.UL) || node.is(TagId.OL)) {
    child=node.content;
    if (child == null) {
      return false;
    }
    if (child.next != null) {
      return false;
    }
    list=child.content;
    if (list == null) {
      return false;
    }
    if (list.tag != node.tag) {
      return false;
    }
    if (list.next != null) {
      return false;
    }
    pnode[0]=list;
    list.prev=node.prev;
    list.next=node.next;
    list.parent=node.parent;
    fixNodeLinks(list);
    child.content=null;
    node.content=null;
    node.next=null;
    node=null;
    if (list.prev != null) {
      if ((list.prev.is(TagId.UL) || list.prev.is(TagId.OL)) && list.prev.last != null) {
        node=list;
        list=node.prev;
        list.next=node.next;
        if (list.next != null) {
          list.next.prev=list;
        }
        child=list.last;
        node.parent=child;
        node.next=null;
        node.prev=child.last;
        fixNodeLinks(node);
        cleanNode(lexer,node);
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Symptom: <ul> <li> <ul> ... </ul> </li> </ul> Action: discard outer list.
 * @param lexer Lexer
 * @param node Node
 * @param pnode passed in as array to allow modifications.
 * @return <code>true</code> if nested lists have been found and replaced
 */
private boolean nestedList(Lexer lexer,Node node,Node[] pnode){
  Node child, list;
  if (node.is(TagId.UL) || node.is(TagId.OL)) {
    child=node.content;
    if (child == null) {
      return false;
    }
    if (child.next != null) {
      return false;
    }
    list=child.content;
    if (list == null) {
      return false;
    }
    if (list.tag != node.tag) {
      return false;
    }
    if (list.next != null) {
      return false;
    }
    pnode[0]=list;
    list.prev=node.prev;
    list.next=node.next;
    list.parent=node.parent;
    fixNodeLinks(list);
    child.content=null;
    node.content=null;
    node.next=null;
    node=null;
    if (list.prev != null) {
      if ((list.prev.is(TagId.UL) || list.prev.is(TagId.OL)) && list.prev.last != null) {
        node=list;
        list=node.prev;
        child=list.last;
        list.next=node.next;
        fixNodeLinks(list);
        node.parent=child;
        node.next=null;
        node.prev=child.last;
        fixNodeLinks(node);
        cleanNode(lexer,node);
      }
    }
    return true;
  }
  return false;
}
Program: 45319
Project: 45319
Buggy source:
/** 
 * Prints encoding error messages.
 * @param lexer Lexer
 * @param code error code
 * @param c invalid char
 */
public void encodingError(Lexer lexer,ErrorCode code,int c,int replaceMode){
  if (lexer.errors > lexer.configuration.getShowErrors()) {
    return;
  }
  if (lexer.configuration.isShowWarnings()) {
    String buf=Integer.toHexString(c);
switch (code) {
case ENCODING_MISMATCH:
      lexer.badChars|=BC_ENCODING_MISMATCH;
    messageLexer(code.code(),lexer,Level.WARNING,"String_Node_Str",lexer.configuration.getInCharEncodingName(),ParsePropertyImpl.CHAR_ENCODING.getFriendlyName(null,new Integer(c),lexer.configuration));
  break;
case VENDOR_SPECIFIC_CHARS:
lexer.badChars|=BC_VENDOR_SPECIFIC_CHARS;
messageLexer(code.code(),lexer,Level.WARNING,"String_Node_Str",replaceMode,buf);
break;
case INVALID_SGML_CHARS:
lexer.badChars|=BC_INVALID_SGML_CHARS;
messageLexer(code.code(),lexer,Level.WARNING,"String_Node_Str",replaceMode,buf);
break;
case INVALID_UTF8:
lexer.badChars|=BC_INVALID_UTF8;
messageLexer(lexer,Level.WARNING,code,replaceMode,buf);
break;
case INVALID_UTF16:
lexer.badChars|=BC_INVALID_UTF16;
messageLexer(lexer,Level.WARNING,code,replaceMode,buf);
break;
case INVALID_NCR:
lexer.badChars|=BC_INVALID_NCR;
messageLexer(lexer,Level.WARNING,code,replaceMode,buf);
break;
}
}
}

Fixed version (ground truth):
/** 
 * Prints encoding error messages.
 * @param lexer Lexer
 * @param code error code
 * @param c invalid char
 */
public void encodingError(Lexer lexer,ErrorCode code,int c,int replaceMode){
  if (lexer.errors > lexer.configuration.getShowErrors()) {
    return;
  }
  if (lexer.configuration.isShowWarnings()) {
    String buf=Integer.toHexString(c);
switch (code) {
case ENCODING_MISMATCH:
      lexer.badChars|=BC_ENCODING_MISMATCH;
    messageLexer(code.code(),lexer,Level.WARNING,"String_Node_Str",lexer.configuration.getInCharEncodingName(),ParsePropertyImpl.CHAR_ENCODING.getFriendlyName(null,new Integer(c),lexer.configuration));
  break;
case VENDOR_SPECIFIC_CHARS:
lexer.badChars|=BC_VENDOR_SPECIFIC_CHARS;
messageLexer(code.code(),lexer,Level.WARNING,"String_Node_Str",replaceMode,buf);
break;
case INVALID_SGML_CHARS:
lexer.badChars|=BC_INVALID_SGML_CHARS;
messageLexer(code.code(),lexer,Level.WARNING,"String_Node_Str",replaceMode,buf);
break;
case INVALID_UTF8:
lexer.badChars|=BC_INVALID_UTF8;
messageLexer(lexer,Level.WARNING,code,replaceMode,buf);
break;
case INVALID_UTF16:
lexer.badChars|=BC_INVALID_UTF16;
messageLexer(lexer,Level.WARNING,code,replaceMode,buf);
break;
case INVALID_NCR:
lexer.badChars|=BC_INVALID_NCR;
messageLexer(lexer,Level.WARNING,code,replaceMode,c);
break;
}
}
}
Program: 45322
Project: 45322
Buggy source:
/** 
 * @see org.w3c.dom.Document#createTextNode
 */
public org.w3c.dom.Text createTextNode(String data){
  byte[] textarray=TidyUtils.getBytes(data);
  Node node=new Node(NodeType.TextNode,textarray,0,textarray.length);
  if (node != null) {
    return (org.w3c.dom.Text)node.getAdapter();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @see org.w3c.dom.Document#createTextNode
 */
public org.w3c.dom.Text createTextNode(String data){
  byte[] textarray=TidyUtils.getBytes(data);
  Node node=new Node(NodeType.TextNode,textarray,0,textarray.length);
  return (org.w3c.dom.Text)node.getAdapter();
}
Program: 45323
Project: 45323
Buggy source:
/** 
 * @see org.w3c.dom.Document#createComment
 */
public org.w3c.dom.Comment createComment(String data){
  byte[] textarray=TidyUtils.getBytes(data);
  Node node=new Node(NodeType.CommentTag,textarray,0,textarray.length);
  if (node != null) {
    return (org.w3c.dom.Comment)node.getAdapter();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @see org.w3c.dom.Document#createComment
 */
public org.w3c.dom.Comment createComment(String data){
  byte[] textarray=TidyUtils.getBytes(data);
  Node node=new Node(NodeType.CommentTag,textarray,0,textarray.length);
  return (org.w3c.dom.Comment)node.getAdapter();
}
Program: 45324
Project: 45324
Buggy source:
/** 
 * @see org.w3c.dom.Document#createElement
 */
public org.w3c.dom.Element createElement(String tagName) throws DOMException {
  Node node=new Node(NodeType.StartEndTag,null,0,0,tagName,this.tt);
  if (node != null) {
    if (node.tag == null) {
      node.tag=TagTable.XML_TAGS;
    }
    return (org.w3c.dom.Element)node.getAdapter();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @see org.w3c.dom.Document#createElement
 */
public org.w3c.dom.Element createElement(String tagName) throws DOMException {
  Node node=new Node(NodeType.StartEndTag,null,0,0,tagName,this.tt);
  if (node.tag == null) {
    node.tag=TagTable.XML_TAGS;
  }
  return (org.w3c.dom.Element)node.getAdapter();
}
Program: 45325
Project: 45325
Buggy source:
/** 
 * @see org.w3c.dom.Document#createAttribute
 */
public org.w3c.dom.Attr createAttribute(String name) throws DOMException {
  AttVal av=new AttVal(null,null,'"',name,null);
  if (av != null) {
    av.dict=AttributeTable.getDefaultAttributeTable().findAttribute(av);
    return av.getAdapter();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @see org.w3c.dom.Document#createAttribute
 */
public org.w3c.dom.Attr createAttribute(String name) throws DOMException {
  AttVal av=new AttVal(null,null,'"',name,null);
  av.dict=AttributeTable.getDefaultAttributeTable().findAttribute(av);
  return av.getAdapter();
}
Program: 45326
Project: 45326
Buggy source:
/** 
 * Not supported.
 * @see org.w3c.dom.CharacterData#appendData
 */
public void appendData(String arg) throws DOMException {
  throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @see org.w3c.dom.CharacterData#appendData
 */
public void appendData(String arg) throws DOMException {
  setNodeValue(getNodeValue() + arg);
}
Program: 45327
Project: 45327
Buggy source:
/** 
 * Not supported.
 * @see org.w3c.dom.CharacterData#replaceData
 */
public void replaceData(int offset,int count,String arg) throws DOMException {
  throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @see org.w3c.dom.CharacterData#replaceData
 */
public void replaceData(int offset,int count,String arg) throws DOMException {
  deleteData(offset,count);
  insertData(offset,arg);
}
Program: 45328
Project: 45328
Buggy source:
/** 
 * Not supported.
 * @see org.w3c.dom.CharacterData#deleteData
 */
public void deleteData(int offset,int count) throws DOMException {
  throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @see org.w3c.dom.CharacterData#deleteData
 */
public void deleteData(int offset,int count) throws DOMException {
  if (count < 0) {
    throw new DOMException(DOMException.INDEX_SIZE_ERR,"String_Node_Str");
  }
  if (offset < adaptee.start || adaptee.start + offset >= adaptee.end) {
    throw new DOMException(DOMException.INDEX_SIZE_ERR,"String_Node_Str");
  }
  StringBuilder sb=new StringBuilder(getNodeValue());
  int end=offset + count;
  if (end > adaptee.end) {
    end=adaptee.end;
  }
  setData(sb.delete(offset,end).toString());
}
Program: 45329
Project: 45329
Buggy source:
/** 
 * Not supported.
 * @see org.w3c.dom.CharacterData#setData
 */
public void setData(String data) throws DOMException {
  throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @see org.w3c.dom.CharacterData#setData
 */
public void setData(String data) throws DOMException {
  setNodeValue(data);
}
Program: 45330
Project: 45330
Buggy source:
/** 
 * Not supported.
 * @see org.w3c.dom.CharacterData#insertData
 */
public void insertData(int offset,String arg) throws DOMException {
  throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @see org.w3c.dom.CharacterData#insertData
 */
public void insertData(int offset,String arg) throws DOMException {
  if (offset < adaptee.start || adaptee.start + offset >= adaptee.end) {
    throw new DOMException(DOMException.INDEX_SIZE_ERR,"String_Node_Str");
  }
  StringBuilder sb=new StringBuilder(getNodeValue());
  sb.insert(offset,arg);
  setData(sb.toString());
}
Program: 45331
Project: 45331
Buggy source:
/** 
 * Should always be able convert to/from UTF-8, so encoding exceptions are converted to an Error to avoid adding throws declarations in lots of methods.
 * @param bytes byte array
 * @param offset starting offset in byte array
 * @param length length in byte array starting from offset
 * @return same as <code>new String(bytes, offset, length, "UTF8")</code>
 */
public static String getString(final byte[] bytes,final int offset,final int length){
  try {
    return length == 0 ? null : new String(bytes,offset,Math.min(length,bytes.length - offset),"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    throw new Error("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Should always be able convert to/from UTF-8, so encoding exceptions are converted to an Error to avoid adding throws declarations in lots of methods.
 * @param bytes byte array
 * @param offset starting offset in byte array
 * @param length length in byte array starting from offset
 * @return same as <code>new String(bytes, offset, length, "UTF8")</code>
 */
public static String getString(final byte[] bytes,final int offset,final int length){
  try {
    return new String(bytes,offset,Math.min(length,bytes.length - offset),"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    throw new Error("String_Node_Str" + e.getMessage());
  }
}
Program: 45332
Project: 45332
Buggy source:
/** 
 * prints available configuration options.
 * @param errout where to write
 * @param showActualConfiguration print actual configuration values
 */
public void printConfigOptions(Writer errout,boolean showActualConfiguration){
  String pad="String_Node_Str";
  try {
    errout.write("String_Node_Str");
    if (showActualConfiguration) {
      errout.write("String_Node_Str");
    }
 else {
      errout.write("String_Node_Str");
    }
    errout.write("String_Node_Str");
    for (    Option configItem : Options.getOptions()) {
      errout.write(configItem.getName());
      errout.write(pad,0,28 - configItem.getName().length());
      errout.write(configItem.getParser().getType());
      errout.write(pad,0,11 - configItem.getParser().getType().length());
      if (showActualConfiguration) {
        Object actualValue=options.get(configItem);
        errout.write(configItem.getParser().getFriendlyName(configItem.getName(),actualValue,this));
      }
 else {
        errout.write(configItem.getParser().getOptionValues());
      }
      errout.write("String_Node_Str");
    }
    errout.flush();
  }
 catch (  IOException e) {
    throw new RuntimeException(e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * prints available configuration options.
 * @param errout where to write
 * @param showActualConfiguration print actual configuration values
 */
public void printConfigOptions(Writer errout,boolean showActualConfiguration){
  String pad="String_Node_Str";
  try {
    errout.write("String_Node_Str");
    if (showActualConfiguration) {
      errout.write("String_Node_Str");
    }
 else {
      errout.write("String_Node_Str");
    }
    errout.write("String_Node_Str");
    final Option[] op=Option.values();
    Arrays.sort(op,Option.getComparator());
    for (    Option configItem : op) {
      final ParseProperty parser=configItem.getParser();
      if (parser == null) {
        continue;
      }
      errout.write(configItem.getName());
      errout.write(pad,0,28 - configItem.getName().length());
      String type=parser.getType();
      if (type == null) {
        type="String_Node_Str";
      }
      errout.write(type);
      errout.write(pad,0,11 - type.length());
      if (showActualConfiguration) {
        final Object actualValue=options.get(configItem);
        errout.write(parser.getFriendlyName(configItem.getName(),actualValue,this));
      }
 else {
        String values=parser.getOptionValues();
        if (values == null) {
          values=configItem.getPickList().getDescription();
        }
        errout.write(values);
      }
      errout.write("String_Node_Str");
    }
    errout.flush();
  }
 catch (  IOException e) {
    throw new RuntimeException(e.getMessage());
  }
}
Program: 45333
Project: 45333
Buggy source:
/** 
 * Is the given String a valid configuration flag?
 * @param name configuration parameter name
 * @return <code>true</code> if the given String is a valid config option
 */
public static boolean isKnownOption(String name){
  return name != null && Options.getOption(name) != null;
}

Fixed version (ground truth):
/** 
 * Is the given String a valid configuration flag?
 * @param name configuration parameter name
 * @return <code>true</code> if the given String is a valid config option
 */
public static boolean isKnownOption(String name){
  return name != null && Option.valueOf(name) != null;
}
Program: 45334
Project: 45334
Buggy source:
/** 
 * Parses the configuration properties file.
 */
private void parseProps(){
  for (  Object o : properties.keySet()) {
    String key=(String)o;
    if (key.startsWith("String_Node_Str")) {
      continue;
    }
    Option flag=Options.getOption(key);
    if (flag == null) {
      report.unknownOption(key);
      continue;
    }
    String stringValue=properties.getProperty(key);
    Object value=flag.getParser().parse(stringValue,flag,this);
    options.put(flag,value);
  }
}

Fixed version (ground truth):
/** 
 * Parses the configuration properties file.
 */
private void parseProps(){
  for (  Object o : properties.keySet()) {
    String key=(String)o;
    if (key.startsWith("String_Node_Str")) {
      continue;
    }
    Option flag=Option.valueOf(key);
    if (flag == null) {
      report.unknownOption(key);
      continue;
    }
    String stringValue=properties.getProperty(key);
    Object value=flag.getParser().parse(stringValue,flag,this);
    options.put(flag,value);
  }
}
Program: 45335
Project: 45335
Buggy source:
/** 
 * @see org.w3c.dom.Node#insertBefore
 */
public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild,org.w3c.dom.Node refChild){
  if (newChild == null) {
    return null;
  }
  if (!(newChild instanceof DOMNodeImpl)) {
    throw new DOMException(DOMException.WRONG_DOCUMENT_ERR,"String_Node_Str");
  }
  DOMNodeImpl newCh=(DOMNodeImpl)newChild;
  if (this.adaptee.type == NodeType.RootNode) {
    if (newCh.adaptee.type != NodeType.DocTypeTag && newCh.adaptee.type != NodeType.ProcInsTag) {
      throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,"String_Node_Str");
    }
  }
 else   if (this.adaptee.type == NodeType.StartTag) {
    if (newCh.adaptee.type != NodeType.StartTag && newCh.adaptee.type != NodeType.StartEndTag && newCh.adaptee.type != NodeType.CommentTag && newCh.adaptee.type != NodeType.TextNode && newCh.adaptee.type != NodeType.CDATATag) {
      throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,"String_Node_Str");
    }
  }
  if (refChild == null) {
    this.adaptee.insertNodeAtEnd(newCh.adaptee);
    if (this.adaptee.type == NodeType.StartEndTag) {
      this.adaptee.setType(NodeType.StartTag);
    }
  }
 else {
    Node ref=this.adaptee.content;
    while (ref != null) {
      if (ref.getAdapter() == refChild) {
        break;
      }
      ref=ref.next;
    }
    if (ref == null) {
      throw new DOMException(DOMException.NOT_FOUND_ERR,"String_Node_Str");
    }
    Node.insertNodeBeforeElement(ref,newCh.adaptee);
  }
  return newChild;
}

Fixed version (ground truth):
/** 
 * @see org.w3c.dom.Node#insertBefore
 */
public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild,org.w3c.dom.Node refChild){
  if (newChild == null) {
    return null;
  }
  if (!(newChild instanceof DOMNodeImpl)) {
    throw new DOMException(DOMException.WRONG_DOCUMENT_ERR,"String_Node_Str");
  }
  DOMNodeImpl newCh=(DOMNodeImpl)newChild;
  if (this.adaptee.type == NodeType.RootNode) {
    if (newCh.adaptee.type != NodeType.DocTypeTag && newCh.adaptee.type != NodeType.ProcInsTag) {
      throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,"String_Node_Str");
    }
  }
 else   if (this.adaptee.type == NodeType.StartTag) {
    if (newCh.adaptee.type != NodeType.StartTag && newCh.adaptee.type != NodeType.StartEndTag && newCh.adaptee.type != NodeType.CommentTag && newCh.adaptee.type != NodeType.TextNode && newCh.adaptee.type != NodeType.CDATATag) {
      throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,"String_Node_Str");
    }
  }
  newCh.adaptee.removeNode();
  if (refChild == null) {
    this.adaptee.insertNodeAtEnd(newCh.adaptee);
    if (this.adaptee.type == NodeType.StartEndTag) {
      this.adaptee.setType(NodeType.StartTag);
    }
  }
 else {
    final DOMNodeImpl refCh=(DOMNodeImpl)refChild;
    if (refCh.adaptee.parent != adaptee) {
      throw new DOMException(DOMException.NOT_FOUND_ERR,"String_Node_Str");
    }
    Node.insertNodeBeforeElement(refCh.adaptee,newCh.adaptee);
  }
  return newChild;
}
Program: 45336
Project: 45336
Buggy source:
/** 
 * @see org.w3c.dom.Node#replaceChild
 */
public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,org.w3c.dom.Node oldChild){
  if (newChild == null) {
    return null;
  }
  if (!(newChild instanceof DOMNodeImpl)) {
    throw new DOMException(DOMException.WRONG_DOCUMENT_ERR,"String_Node_Str");
  }
  DOMNodeImpl newCh=(DOMNodeImpl)newChild;
  if (this.adaptee.type == NodeType.RootNode) {
    if (newCh.adaptee.type != NodeType.DocTypeTag && newCh.adaptee.type != NodeType.ProcInsTag) {
      throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,"String_Node_Str");
    }
  }
 else   if (this.adaptee.type == NodeType.StartTag) {
    if (newCh.adaptee.type != NodeType.StartTag && newCh.adaptee.type != NodeType.StartEndTag && newCh.adaptee.type != NodeType.CommentTag && newCh.adaptee.type != NodeType.TextNode && newCh.adaptee.type != NodeType.CDATATag) {
      throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,"String_Node_Str");
    }
  }
  if (oldChild == null) {
    throw new DOMException(DOMException.NOT_FOUND_ERR,"String_Node_Str");
  }
  Node n;
  Node ref=this.adaptee.content;
  while (ref != null) {
    if (ref.getAdapter() == oldChild) {
      break;
    }
    ref=ref.next;
  }
  if (ref == null) {
    throw new DOMException(DOMException.NOT_FOUND_ERR,"String_Node_Str");
  }
  newCh.adaptee.next=ref.next;
  newCh.adaptee.prev=ref.prev;
  newCh.adaptee.last=ref.last;
  newCh.adaptee.parent=ref.parent;
  newCh.adaptee.content=ref.content;
  if (ref.parent != null) {
    if (ref.parent.content == ref) {
      ref.parent.content=newCh.adaptee;
    }
    if (ref.parent.last == ref) {
      ref.parent.last=newCh.adaptee;
    }
  }
  if (ref.prev != null) {
    ref.prev.next=newCh.adaptee;
  }
  if (ref.next != null) {
    ref.next.prev=newCh.adaptee;
  }
  for (n=ref.content; n != null; n=n.next) {
    if (n.parent == ref) {
      n.parent=newCh.adaptee;
    }
  }
  return oldChild;
}

Fixed version (ground truth):
/** 
 * @see org.w3c.dom.Node#replaceChild
 */
public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,org.w3c.dom.Node oldChild){
  insertBefore(newChild,oldChild);
  if (newChild != oldChild) {
    removeChild(oldChild);
  }
  return oldChild;
}
Program: 45337
Project: 45337
Buggy source:
/** 
 * Print just the content of the body element. Useful when you want to reuse material from other documents.
 * @param fout
 * @param lexer
 * @param root
 * @param xml
 */
void printBody(Out fout,Lexer lexer,Node root,boolean xml){
  if (root == null) {
    return;
  }
  Node body=root.findBody();
  if (body != null) {
    Node content;
    for (content=body.content; content != null; content=content.next) {
      if (xml) {
        printXMLTree(fout,(short)0,0,lexer,content);
      }
 else {
        printTree(fout,(short)0,0,lexer,content);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Print just the content of the body element. Useful when you want to reuse material from other documents.
 * @param fout
 * @param lexer
 * @param root
 * @param xml
 */
void printBody(Out fout,Lexer lexer,Node root,boolean xml){
  if (root == null) {
    return;
  }
  Node body=root.findBody();
  if (body != null) {
    Node content;
    for (content=body.content; content != null; content=content.next) {
      printTree(fout,(short)0,0,lexer,content);
    }
  }
}
Program: 45338
Project: 45338
Buggy source:
/** 
 * Used to check script node for script language.
 * @return <code>true</code> if the script node contains javascript
 */
public boolean isJavaScript(){
  boolean result=false;
  AttVal attr;
  if (this.attributes == null) {
    return true;
  }
  for (attr=this.attributes; attr != null; attr=attr.next) {
    if (("String_Node_Str".equalsIgnoreCase(attr.attribute) || "String_Node_Str".equalsIgnoreCase(attr.attribute)) && "String_Node_Str".equalsIgnoreCase(attr.value)) {
      result=true;
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Used to check script node for script language.
 * @return <code>true</code> if the script node contains javascript
 */
public boolean isJavaScript(){
  boolean result=false;
  AttVal attr;
  if (this.attributes == null) {
    return true;
  }
  for (attr=this.attributes; attr != null; attr=attr.next) {
    if (("String_Node_Str".equalsIgnoreCase(attr.attribute) || "String_Node_Str".equalsIgnoreCase(attr.attribute)) && attr.value.toLowerCase().contains("String_Node_Str")) {
      result=true;
    }
  }
  return result;
}
Program: 45339
Project: 45339
Buggy source:
/** 
 * This maps <code>&lt;p> hello &lt;em> world &lt;/em></code> to <code>&lt;p> hello &lt;em> world &lt;/em></code>. Trims initial space, by moving it before the start tag, or if this element is the first in parent's content, then by discarding the space.
 * @param lexer Lexer
 * @param element parent node
 * @param text text node
 */
public static void trimInitialSpace(Lexer lexer,Node element,Node text){
  Node prev, node;
  if (text.type == NodeType.TextNode && text.textarray[text.start] == (byte)' ' && (text.start < text.end)) {
    if (TidyUtils.toBoolean(element.tag.model & Dict.CM_INLINE) && !TidyUtils.toBoolean(element.tag.model & Dict.CM_FIELD) && element.parent.content != element) {
      prev=element.prev;
      if (prev != null && prev.type == NodeType.TextNode) {
        if (prev.textarray[prev.end - 1] != (byte)' ') {
          prev.textarray[prev.end++]=(byte)' ';
        }
        ++element.start;
      }
 else {
        node=lexer.newNode();
        if (element.start >= element.end) {
          node.start=0;
          node.end=1;
          node.textarray=new byte[1];
        }
 else {
          node.start=element.start++;
          node.end=element.start;
          node.textarray=element.textarray;
        }
        node.textarray[node.start]=(byte)' ';
        node.prev=prev;
        if (prev != null) {
          prev.next=node;
        }
        node.next=element;
        element.prev=node;
        node.parent=element.parent;
      }
    }
    ++text.start;
  }
}

Fixed version (ground truth):
/** 
 * This maps <code>&lt;p> hello &lt;em> world &lt;/em></code> to <code>&lt;p> hello &lt;em> world &lt;/em></code>. Trims initial space, by moving it before the start tag, or if this element is the first in parent's content, then by discarding the space.
 * @param lexer Lexer
 * @param element parent node
 * @param text text node
 */
public static void trimInitialSpace(Lexer lexer,Node element,Node text){
  Node prev, node;
  if (text.type == NodeType.TextNode && lexer.lexbuf[text.start] == (byte)' ' && (text.start < text.end)) {
    if (TidyUtils.toBoolean(element.tag.model & Dict.CM_INLINE) && !TidyUtils.toBoolean(element.tag.model & Dict.CM_FIELD)) {
      prev=element.prev;
      if (prev != null && prev.type == NodeType.TextNode) {
        if (prev.textarray[prev.end - 1] != (byte)' ') {
          prev.textarray[prev.end++]=(byte)' ';
        }
        ++element.start;
      }
 else {
        node=lexer.newNode();
        if (element.start >= element.end) {
          node.start=0;
          node.end=1;
          node.textarray=new byte[1];
        }
 else {
          node.start=element.start++;
          node.end=element.start;
          node.textarray=element.textarray;
        }
        node.textarray[node.start]=(byte)' ';
        Node.insertNodeBeforeElement(element,node);
      }
    }
    ++text.start;
  }
}
Program: 45340
Project: 45340
Buggy source:
/** 
 * Is the given character encoding supported?
 * @param name character encoding name
 * @return <code>true</code> if encoding is supported, false otherwhise.
 */
public static boolean isCharEncodingSupported(String name){
  name=EncodingNameMapper.toJava(name);
  if (name == null) {
    return false;
  }
  try {
    "String_Node_Str".getBytes(name);
  }
 catch (  java.io.UnsupportedEncodingException e) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Is the given character encoding supported?
 * @param name character encoding name
 * @return <code>true</code> if encoding is supported, false otherwhise.
 */
public static boolean isCharEncodingSupported(String name){
  name=EncodingNameMapper.toJava(name);
  if (name == null) {
    return false;
  }
  try {
    "String_Node_Str".getBytes(name);
  }
 catch (  UnsupportedEncodingException e) {
    return false;
  }
  return true;
}