nus-yam/ex-repair huggingface dataset:
Program: 152613
Project: 152613
Buggy source:
public static Pokemon getPokemon(PokemonSpecies species){
  Pokemon pokemon=new Pokemon(species);
  pokemon.setLevel(8);
  pokemon.setGender(Gender.MALE);
  pokemon.setAbility(Abilities.OVERGROW);
  pokemon.setSlot1(Main.mMoveArray[1]);
  pokemon.setHPStat(setHPStat(pokemon,species));
  for (  Stats stat : Stats.values()) {
    pokemon.setStats(setStat(pokemon,species,stat),stat);
  }
  pokemon.setCurrentHP(pokemon.getHPStat());
  return pokemon;
}

Fixed version (ground truth):
public static Pokemon getPokemon(PokemonSpecies species){
  Pokemon pokemon=new Pokemon(species);
  pokemon.setLevel(1);
  pokemon.setGender(Gender.MALE);
  pokemon.setAbility(Abilities.OVERGROW);
  pokemon.setSlot1(Main.mMoveArray[1]);
  pokemon.setHPStat(setHPStat(pokemon,species));
  for (  Stats stat : Stats.values()) {
    pokemon.setStats(setStat(pokemon,species,stat),stat);
  }
  pokemon.setCurrentHP(pokemon.getHPStat());
  return pokemon;
}
Program: 152614
Project: 152614
Buggy source:
private static int setHPStat(Pokemon pokemon,PokemonSpecies species){
  int maxHP=1;
  maxHP=(((pokemon.getHPIV() + (2 * species.getSpecificStat(0)) + pokemon.getHPEVs() / 4 + 100) * pokemon.getLevel()) / 100) + 10;
  return maxHP;
}

Fixed version (ground truth):
private static int setHPStat(Pokemon pokemon,PokemonSpecies species){
  int maxHP=1;
  maxHP=(((pokemon.getHPIV() + (2 * species.getSpecificStat(0)) + (pokemon.getHPEVs() / 4)+ 100) * pokemon.getLevel()) / 100) + 10;
  return maxHP;
}
Program: 152615
Project: 152615
Buggy source:
public static double typeMath(Types moveType,Types defenderType1,Types defenderType2){
  if (defenderType1 == Types.NONE && defenderType2 == Types.NONE) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  double retValue=0.0;
  if (defenderType2 == Types.NONE) {
    retValue=typeMatrix[moveType.id][defenderType1];
  }
 else   if (defenderType1 == Types.NONE) {
    retValue=typeMatrix[moveType.id][defenderType2];
  }
 else {
    retValue=typeMatrix[moveType.id][defenderType1] * typeMatrix[moveType][defenderType2];
  }
  return retValue;
}

Fixed version (ground truth):
public static double typeMath(Types moveType,Types defenderType1,Types defenderType2){
  if (defenderType1 == Types.NONE && defenderType2 == Types.NONE) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  double retValue=0.0;
  if (defenderType2 == Types.NONE) {
    retValue=typeMatrix[moveType.id][defenderType1.id];
  }
 else   if (defenderType1 == Types.NONE) {
    retValue=typeMatrix[moveType.id][defenderType2.id];
  }
 else {
    retValue=typeMatrix[moveType.id][defenderType1.id] * typeMatrix[moveType.id][defenderType2.id];
  }
  return retValue;
}
Program: 152616
Project: 152616
Buggy source:
Species(){
  mName="String_Node_Str";
  mDexNum=999;
  mType1=-1;
  mType2=-1;
  mBaseStats[0]=10;
  for (int i=0; i < 20; i++) {
    levelMoves[i][0]=0;
    levelMoves[i][1]=0;
  }
  for (int i=0; i < 110; i++) {
    tmMoves[i]=0;
  }
  for (int i=0; i < 30; i++) {
    eggMoves[i]=0;
  }
  for (int i=0; i < 30; i++) {
    tutorMoves[i]=0;
  }
  catchRate=0;
  eggSteps=0;
  growthRate=0;
  eggType=0;
  genderRatio=-1;
  weight=0.00;
  backSprite="String_Node_Str";
  frontSprite="String_Node_Str";
  backSpriteSh="String_Node_Str";
  frontSpriteSh="String_Node_Str";
  overworldSprites=null;
  inventorySprite=null;
  crySound=null;
}

Fixed version (ground truth):
Species(){
  mName="String_Node_Str";
  mDexNum=999;
  mType1=-1;
  mType2=-1;
  mBaseStats[0]=10;
  for (int i=0; i < 20; i++) {
    mLevelMoves[i][0]=0;
    mLevelMoves[i][1]=0;
  }
  for (int i=0; i < 110; i++) {
    mTmMoves[i]=0;
  }
  for (int i=0; i < 30; i++) {
    mEggMoves[i]=0;
  }
  for (int i=0; i < 30; i++) {
    mTutorMoves[i]=0;
  }
  catchRate=0;
  eggSteps=0;
  growthRate=0;
  eggType=0;
  genderRatio=-1;
  weight=0.00f;
  backSprite="String_Node_Str";
  frontSprite="String_Node_Str";
  backSpriteSh="String_Node_Str";
  frontSpriteSh="String_Node_Str";
  overworldSprites=null;
  inventorySprite=null;
  crySound=null;
}
Program: 152617
Project: 152617
Buggy source:
/** 
 * Trigger.
 * @param jobClass the job class
 */
public void triggerJob(String jobClass,Integer instances){
  Play.plugin(JobsPlugin.class);
  if (StringUtils.isBlank(jobClass)) {
    throw new RuntimeException("String_Node_Str");
  }
  if (instances == null) {
    instances=1;
  }
  if (instances < 1) {
    instances=1;
  }
  Logger.info("String_Node_Str",jobClass,instances);
  try {
    Class clazz=Class.forName(jobClass);
    if (clazz == null) {
      throw new RuntimeException("String_Node_Str" + jobClass);
    }
    ExecutorService executor=Executors.newFixedThreadPool(instances);
    int count=0;
    for (int i=0; i < instances; i++) {
      count=count + 1;
      Object o=clazz.newInstance();
      if ((o instanceof Job) == false) {
        throw new RuntimeException("String_Node_Str" + o);
      }
      Logger.info("String_Node_Str",o);
      Job job=(Job)o;
      executor.submit((Callable)job);
      Logger.info("String_Node_Str",count,job);
    }
  }
 catch (  Throwable t) {
    logError(t);
    throw new UnexpectedException(String.format("String_Node_Str",jobClass));
  }
}

Fixed version (ground truth):
/** 
 * Trigger.
 * @param jobClass the job class
 */
public void triggerJob(String jobClass,Integer instances){
  Play.plugin(JobsPlugin.class);
  if (StringUtils.isBlank(jobClass)) {
    throw new RuntimeException("String_Node_Str");
  }
  if (instances == null) {
    instances=1;
  }
  if (instances < 1) {
    instances=1;
  }
  Logger.info("String_Node_Str",jobClass,instances);
  try {
    Class clazz=Play.classloader.getClassIgnoreCase(jobClass);
    if (clazz == null) {
      throw new RuntimeException("String_Node_Str" + jobClass);
    }
    ExecutorService executor=Executors.newFixedThreadPool(instances);
    int count=0;
    for (int i=0; i < instances; i++) {
      count=count + 1;
      Object o=clazz.newInstance();
      if ((o instanceof Job) == false) {
        throw new RuntimeException("String_Node_Str" + o);
      }
      Logger.info("String_Node_Str",o);
      Job job=(Job)o;
      executor.submit((Callable)job);
      Logger.info("String_Node_Str",count,job);
    }
  }
 catch (  Throwable t) {
    logError(t);
    throw new UnexpectedException(String.format("String_Node_Str",jobClass));
  }
}
Program: 152618
Project: 152618
Buggy source:
@Override public void onUpdate(Context context,AppWidgetManager appWidgetManager,int[] appWidgetIds){
  Cursor c=context.getContentResolver().query(StatusProvider.CONTENT_URI,null,null,null,null);
  try {
    if (c.moveToFirst()) {
      CharSequence user=c.getString(c.getColumnIndex(StatusData.C_USER));
      CharSequence createdAt=DateUtils.getRelativeTimeSpanString(context,c.getLong(c.getColumnIndex(StatusData.C_CREATED_AT)));
      CharSequence message=c.getString(c.getColumnIndex(StatusData.C_TEXT));
      for (      int appWidgetId : appWidgetIds) {
        Log.d(TAG,"String_Node_Str" + appWidgetId);
        RemoteViews views=new RemoteViews(context.getPackageName(),R.layout.yamba_widget);
        views.setTextViewText(R.id.textUser,user);
        views.setTextViewText(R.id.textCreatedAt,createdAt);
        views.setTextViewText(R.id.textText,message);
        views.setOnClickPendingIntent(R.id.yamba_icon,PendingIntent.getActivity(context,0,new Intent(context,TimelineActivity.class),0));
        appWidgetManager.updateAppWidget(appWidgetId,views);
      }
    }
 else {
      Log.d(TAG,"String_Node_Str");
    }
  }
  finally {
    c.close();
  }
  Log.d(TAG,"String_Node_Str");
}

Fixed version (ground truth):
@Override public void onUpdate(Context context,AppWidgetManager appWidgetManager,int[] appWidgetIds){
  Cursor c=context.getContentResolver().query(StatusProvider.CONTENT_URI,null,null,null,StatusData.C_CREATED_AT + "String_Node_Str");
  try {
    if (c.moveToFirst()) {
      CharSequence user=c.getString(c.getColumnIndex(StatusData.C_USER));
      CharSequence createdAt=DateUtils.getRelativeTimeSpanString(context,c.getLong(c.getColumnIndex(StatusData.C_CREATED_AT)));
      CharSequence message=c.getString(c.getColumnIndex(StatusData.C_TEXT));
      for (      int appWidgetId : appWidgetIds) {
        Log.d(TAG,"String_Node_Str" + appWidgetId);
        RemoteViews views=new RemoteViews(context.getPackageName(),R.layout.yamba_widget);
        views.setTextViewText(R.id.textUser,user);
        views.setTextViewText(R.id.textCreatedAt,createdAt);
        views.setTextViewText(R.id.textText,message);
        views.setOnClickPendingIntent(R.id.yamba_icon,PendingIntent.getActivity(context,0,new Intent(context,TimelineActivity.class),0));
        appWidgetManager.updateAppWidget(appWidgetId,views);
      }
    }
 else {
      Log.d(TAG,"String_Node_Str");
    }
  }
  finally {
    c.close();
  }
  Log.d(TAG,"String_Node_Str");
}
Program: 152619
Project: 152619
Buggy source:
private Stanza getSessionCreationResponse(BoshBackedSessionContext session){
  StanzaBuilder body=new StanzaBuilder("String_Node_Str",NamespaceURIs.XEP0124_BOSH);
  body.addAttribute("String_Node_Str",Integer.toString(session.getWait()));
  body.addAttribute("String_Node_Str",Integer.toString(session.getInactivity()));
  body.addAttribute("String_Node_Str",Integer.toString(session.getPolling()));
  body.addAttribute("String_Node_Str",Integer.toString(session.getRequests()));
  body.addAttribute("String_Node_Str",Integer.toString(session.getHold()));
  body.addAttribute("String_Node_Str",session.getSessionId());
  body.addAttribute("String_Node_Str",session.getBoshVersion());
  body.addAttribute("String_Node_Str",session.getServerJID().getFullQualifiedName());
  body.addAttribute("String_Node_Str","String_Node_Str");
  body.addAttribute("String_Node_Str",Integer.toString(session.getMaxPause()));
  body.addAttribute("String_Node_Str",Long.toString(session.getHighestReadRid()));
  Stanza features=new ServerResponses().getFeaturesForAuthentication(serverRuntimeContext.getServerFeatures().getAuthenticationMethods());
  body.addPreparedElement(features);
  return body.build();
}

Fixed version (ground truth):
private Stanza getSessionCreationResponse(BoshBackedSessionContext session){
  StanzaBuilder body=new StanzaBuilder("String_Node_Str",NamespaceURIs.XEP0124_BOSH);
  body.addAttribute("String_Node_Str",Integer.toString(session.getWait()));
  body.addAttribute("String_Node_Str",Integer.toString(session.getInactivity()));
  body.addAttribute("String_Node_Str",Integer.toString(session.getPolling()));
  body.addAttribute("String_Node_Str",Integer.toString(session.getRequests()));
  body.addAttribute("String_Node_Str",Integer.toString(session.getHold()));
  body.addAttribute("String_Node_Str",session.getSessionId());
  body.addAttribute("String_Node_Str",session.getBoshVersion());
  body.addAttribute("String_Node_Str",session.getServerJID().getFullQualifiedName());
  body.addAttribute("String_Node_Str","String_Node_Str");
  body.addAttribute("String_Node_Str",Integer.toString(session.getMaxPause()));
  body.addAttribute("String_Node_Str",Long.toString(session.getHighestReadRid()));
  Stanza features=new ServerResponses().getFeaturesForAuthentication(serverRuntimeContext.getServerFeatures().getAuthenticationMethods(),session);
  body.addPreparedElement(features);
  return body.build();
}
Program: 152621
Project: 152621
Buggy source:
@Override protected Stanza handleGet(IQStanza stanza,ServerRuntimeContext serverRuntimeContext,SessionContext sessionContext){
  return StanzaBuilder.createIQStanza(stanza.getTo(),stanza.getFrom(),IQStanzaType.RESULT,stanza.getID()).startInnerElement("String_Node_Str",NamespaceURIs.XEP0065_SOCKS5_BYTESTREAMS).startInnerElement("String_Node_Str",NamespaceURIs.XEP0065_SOCKS5_BYTESTREAMS).addAttribute("String_Node_Str",proxyAddress.getHostName()).addAttribute("String_Node_Str",jid.getFullQualifiedName()).addAttribute("String_Node_Str",Integer.toString(proxyAddress.getPort())).build();
}

Fixed version (ground truth):
@Override protected Stanza handleGet(IQStanza stanza,ServerRuntimeContext serverRuntimeContext,SessionContext sessionContext){
  StanzaBuilder builder=StanzaBuilder.createIQStanza(stanza.getTo(),stanza.getFrom(),IQStanzaType.RESULT,stanza.getID()).startInnerElement("String_Node_Str",NamespaceURIs.XEP0065_SOCKS5_BYTESTREAMS).startInnerElement("String_Node_Str",NamespaceURIs.XEP0065_SOCKS5_BYTESTREAMS);
  if (DEFAULT_ADDRESS.equals(proxyAddress.getAddress())) {
    builder.addAttribute("String_Node_Str",jid.getFullQualifiedName());
  }
 else {
    builder.addAttribute("String_Node_Str",proxyAddress.getHostName());
  }
  builder.addAttribute("String_Node_Str",jid.getFullQualifiedName()).addAttribute("String_Node_Str",Integer.toString(proxyAddress.getPort()));
  return builder.build();
}
Program: 152622
Project: 152622
Buggy source:
private void startProxy(int port) throws Exception {
  acceptor=new NioSocketAcceptor();
  acceptor.setHandler(new Socks5AcceptorHandler(connectionsRegistry));
  acceptor.getSessionConfig().setBothIdleTime(idleTimeInSeconds);
  acceptor.bind(proxyAddress);
}

Fixed version (ground truth):
private void startProxy() throws Exception {
  acceptor=new NioSocketAcceptor();
  acceptor.setHandler(new Socks5AcceptorHandler(connectionsRegistry));
  acceptor.getSessionConfig().setBothIdleTime(idleTimeInSeconds);
  System.out.println(proxyAddress);
  acceptor.bind(proxyAddress);
}
Program: 152623
Project: 152623
Buggy source:
/** 
 * Constructs a SOCK5 module with the proxy listening on the default address
 * @param subdomain The subdomain for this component, must be only the subdomain, e.g. "socks"
 */
public Socks5Module(String subdomain){
  this(subdomain,null);
}

Fixed version (ground truth):
/** 
 * Constructs a SOCK5 module with the default subdomain "socks" and the proxy listening on the default address
 */
public Socks5Module(){
  this(DEFAULT_SUBDOMAIN,null);
}
Program: 152624
Project: 152624
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void initialize(ServerRuntimeContext serverRuntimeContext){
  super.initialize(serverRuntimeContext);
  fullDomain=EntityUtils.createComponentDomain(subdomain,serverRuntimeContext);
  if (proxyAddress == null) {
    proxyAddress=new InetSocketAddress(fullDomain.getFullQualifiedName(),port);
  }
  stanzaProcessor=new ComponentStanzaProcessor(serverRuntimeContext);
  stanzaProcessor.addHandler(new Socks5IqHandler(fullDomain,proxyAddress,connectionsRegistry));
  try {
    startProxy(port);
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void initialize(ServerRuntimeContext serverRuntimeContext){
  super.initialize(serverRuntimeContext);
  fullDomain=EntityUtils.createComponentDomain(subdomain,serverRuntimeContext);
  stanzaProcessor=new ComponentStanzaProcessor(serverRuntimeContext);
  stanzaProcessor.addHandler(new Socks5IqHandler(fullDomain,proxyAddress,connectionsRegistry));
  try {
    startProxy();
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 152625
Project: 152625
Buggy source:
@Override protected Stanza executeIQLogic(IQStanza stanza,ServerRuntimeContext serverRuntimeContext,boolean outboundStanza,SessionContext sessionContext){
switch (stanza.getIQType()) {
case SET:
    return StanzaBuilder.createIQStanza(null,null,IQStanzaType.RESULT,stanza.getID()).addAttribute("String_Node_Str",sessionContext.getServerJID().getFullQualifiedName()).build();
case GET:
case ERROR:
default :
  new RuntimeException("String_Node_Str" + stanza.getIQType());
}
return null;
}

Fixed version (ground truth):
@Override protected Stanza executeIQLogic(IQStanza stanza,ServerRuntimeContext serverRuntimeContext,boolean outboundStanza,SessionContext sessionContext){
switch (stanza.getIQType()) {
case SET:
    return StanzaBuilder.createIQStanza(null,null,IQStanzaType.RESULT,stanza.getID()).addAttribute("String_Node_Str",sessionContext.getServerJID().getFullQualifiedName()).build();
case GET:
case ERROR:
default :
  throw new RuntimeException("String_Node_Str" + stanza.getIQType());
}
}
Program: 152626
Project: 152626
Buggy source:
public void testAbort() throws XMLSemanticError, AuthorizationFailedException {
  executeAbortAuthorization_3Times();
  StanzaBuilder stanzaBuilder=createAbort();
  Stanza abortPlainStanza=stanzaBuilder.build();
  stanzaBuilder=new StanzaBuilder("String_Node_Str",NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_SASL);
  stanzaBuilder.addAttribute("String_Node_Str","String_Node_Str");
  stanzaBuilder.addText(new String(Base64.encodeBase64("String_Node_Str".getBytes())));
  Stanza authPlainStanza=stanzaBuilder.build();
  AuthHandler authHandler=new AuthHandler();
  try {
    ResponseStanzaContainer responseContainer=authHandler.execute(authPlainStanza,sessionContext.getServerRuntimeContext(),true,sessionContext,sessionStateHolder);
    fail("String_Node_Str");
  }
 catch (  AuthorizationFailedException e) {
  }
}

Fixed version (ground truth):
public void testAbort() throws XMLSemanticError, AuthorizationFailedException {
  executeAbortAuthorization_3Times();
  StanzaBuilder stanzaBuilder=createAbort();
  stanzaBuilder=new StanzaBuilder("String_Node_Str",NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_SASL);
  stanzaBuilder.addAttribute("String_Node_Str","String_Node_Str");
  stanzaBuilder.addText(new String(Base64.encodeBase64("String_Node_Str".getBytes())));
  Stanza authPlainStanza=stanzaBuilder.build();
  AuthHandler authHandler=new AuthHandler();
  try {
    ResponseStanzaContainer responseContainer=authHandler.execute(authPlainStanza,sessionContext.getServerRuntimeContext(),true,sessionContext,sessionStateHolder);
    fail("String_Node_Str");
  }
 catch (  AuthorizationFailedException e) {
  }
}
Program: 152627
Project: 152627
Buggy source:
private void restart(){
  log.trace("String_Node_Str");
  elements.clear();
  nsResolver=new ParserNamespaceResolver();
  sentStartDocument=false;
}

Fixed version (ground truth):
private void restart(){
  log.trace("String_Node_Str");
  elements.clear();
  nsResolver=new ParserNamespaceResolver();
  sentStartDocument=false;
  tokenizer.restart();
}
Program: 152629
Project: 152629
Buggy source:
private void emit(IoBuffer byteBuffer,CharsetDecoder decoder) throws SAXException {
  int endPosition=byteBuffer.position();
  int oldLimit=byteBuffer.limit();
  byteBuffer.position(lastPosition);
  byteBuffer.limit(endPosition - 1);
  try {
    listener.token(NO_CHAR,byteBuffer.getString(decoder));
  }
 catch (  CharacterCodingException e) {
    throw new SAXException(e);
  }
  byteBuffer.limit(oldLimit);
  byteBuffer.position(endPosition);
  lastPosition=byteBuffer.position();
}

Fixed version (ground truth):
private void emit(IoBuffer byteBuffer,CharsetDecoder decoder) throws SAXException {
  try {
    buffer.flip();
    listener.token(NO_CHAR,buffer.getString(decoder));
    buffer.clear();
  }
 catch (  CharacterCodingException e) {
    throw new SAXException(e);
  }
}
Program: 152630
Project: 152630
Buggy source:
public void close(){
  state=State.CLOSED;
}

Fixed version (ground truth):
public void close(){
  state=State.CLOSED;
  buffer.clear();
}
Program: 152631
Project: 152631
Buggy source:
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || !(o instanceof XMLElement))   return false;
  final XMLElement that=(XMLElement)o;
  if (attributes != null ? !attributes.equals(that.attributes) : that.attributes != null)   return false;
  if (innerFragments != null ? !innerFragments.equals(that.innerFragments) : that.innerFragments != null) {
    return false;
  }
  if (name != null ? !name.equals(that.name) : that.name != null)   return false;
  if (namespacePrefix != null ? !namespacePrefix.equals(that.namespacePrefix) : that.namespacePrefix != null)   return false;
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || !(o instanceof XMLElement))   return false;
  final XMLElement that=(XMLElement)o;
  if (attributes != null && that.attributes != null) {
    if (attributes.size() != that.attributes.size())     return false;
    for (    Attribute attribute : attributes) {
      boolean found=false;
      for (      Attribute thatAttribute : that.attributes) {
        if (thatAttribute.equals(attribute)) {
          found=true;
          break;
        }
      }
      if (!found)       return false;
    }
  }
 else   if (attributes == null && that.attributes == null) {
  }
 else {
    return false;
  }
  if (innerFragments != null ? !innerFragments.equals(that.innerFragments) : that.innerFragments != null) {
    return false;
  }
  if (name != null ? !name.equals(that.name) : that.name != null)   return false;
  if (namespacePrefix != null ? !namespacePrefix.equals(that.namespacePrefix) : that.namespacePrefix != null)   return false;
  return true;
}
Program: 152632
Project: 152632
Buggy source:
public boolean verifyCredentials(String username,String passwordCleartext,Object credentials){
  return verify(username,passwordCleartext);
}

Fixed version (ground truth):
public boolean verifyCredentials(String username,String passwordCleartext,Object credentials){
  return verify(EntityImpl.parseUnchecked(username).getBareJID(),passwordCleartext);
}
Program: 152633
Project: 152633
Buggy source:
public boolean verifyAccountExists(Entity jid){
  return userPasswordMap.get(jid.getBareJID().getFullQualifiedName()) != null;
}

Fixed version (ground truth):
public boolean verifyAccountExists(Entity jid){
  return userPasswordMap.get(jid.getBareJID()) != null;
}
Program: 152634
Project: 152634
Buggy source:
private boolean verify(String username,String passwordCleartext){
  return passwordCleartext.equals(userPasswordMap.get(username));
}

Fixed version (ground truth):
private boolean verify(Entity username,String passwordCleartext){
  return passwordCleartext.equals(userPasswordMap.get(username));
}
Program: 152635
Project: 152635
Buggy source:
public AdhocCommandHandler getCommandHandler(String commandNode,Entity executingUser){
  if (executingUser == null)   return null;
  final AccountManagement accountManagement=(AccountManagement)serverRuntimeContext.getStorageProvider(AccountManagement.class);
  final ResourceRegistry resourceRegistry=serverRuntimeContext.getResourceRegistry();
  if (!admins.contains(executingUser)) {
    if (commandNode.equals(COMMAND_CHANGE_USER_PASSWORD)) {
      return new ChangeUserPasswordCommandHandler(accountManagement,executingUser);
    }
    return null;
  }
  if (commandNode.equals(COMMAND_NODE_ADD_USER)) {
    if (accountManagement == null)     return null;
    return new AddUserCommandHandler(accountManagement,Arrays.asList(serverRuntimeContext.getServerEnitity().getDomain()));
  }
 else   if (commandNode.equals(COMMAND_CHANGE_USER_PASSWORD)) {
    return new ChangeUserPasswordCommandHandler(accountManagement,null);
  }
 else   if (commandNode.equals(COMMAND_GET_ONLINE_USERS_NUM)) {
    return new GetOnlineUsersCommandHandler(resourceRegistry);
  }
  return null;
}

Fixed version (ground truth):
public AdhocCommandHandler getCommandHandler(String commandNode,Entity executingUser){
  if (executingUser == null)   return null;
  final AccountManagement accountManagement=(AccountManagement)serverRuntimeContext.getStorageProvider(AccountManagement.class);
  final ResourceRegistry resourceRegistry=serverRuntimeContext.getResourceRegistry();
  if (!admins.contains(executingUser.getBareJID())) {
    if (commandNode.equals(COMMAND_CHANGE_USER_PASSWORD)) {
      return new ChangeUserPasswordCommandHandler(accountManagement,executingUser);
    }
    return null;
  }
  if (commandNode.equals(COMMAND_NODE_ADD_USER)) {
    if (accountManagement == null)     return null;
    return new AddUserCommandHandler(accountManagement,Arrays.asList(serverRuntimeContext.getServerEnitity().getDomain()));
  }
 else   if (commandNode.equals(COMMAND_CHANGE_USER_PASSWORD)) {
    return new ChangeUserPasswordCommandHandler(accountManagement,null);
  }
 else   if (commandNode.equals(COMMAND_GET_ONLINE_USERS_NUM)) {
    return new GetOnlineUsersCommandHandler(resourceRegistry);
  }
  return null;
}
Program: 152636
Project: 152636
Buggy source:
public void messageSent(NextFilter nextFilter,IoSession session,WriteRequest request) throws Exception {
  Object message=request.getMessage();
  if (message instanceof StanzaWriteInfo) {
    StanzaWriteInfo stanzaWriteInfo=(StanzaWriteInfo)message;
    if (serverLogger.isDebugEnabled()) {
      String xml=toXml(stanzaWriteInfo.getStanza(),stanzaWriteInfo.isWriteOpeningElement(),stanzaWriteInfo.isWriteClosingElement());
      serverLogger.info("String_Node_Str" + xml);
    }
 else     if (serverLogger.isInfoEnabled()) {
      serverLogger.info(DenseStanzaLogRenderer.render(stanzaWriteInfo.getStanza()));
    }
  }
  nextFilter.messageSent(session,request);
}

Fixed version (ground truth):
public void messageSent(NextFilter nextFilter,IoSession session,WriteRequest request) throws Exception {
  Object message=request.getMessage();
  if (message instanceof StanzaWriteInfo) {
    StanzaWriteInfo stanzaWriteInfo=(StanzaWriteInfo)message;
    if (serverLogger.isDebugEnabled()) {
      String xml=toXml(stanzaWriteInfo.getStanza(),stanzaWriteInfo.isWriteOpeningElement(),stanzaWriteInfo.isWriteClosingElement());
      serverLogger.debug("String_Node_Str" + xml);
    }
 else     if (serverLogger.isInfoEnabled()) {
      serverLogger.info(DenseStanzaLogRenderer.render(stanzaWriteInfo.getStanza()));
    }
  }
  nextFilter.messageSent(session,request);
}
Program: 152637
Project: 152637
Buggy source:
/** 
 * @throws IOException 
 * @throws RuntimeException a wrapper of the possible{@link java.lang.Exception} that Jetty can throw at start-up
 */
public void start() throws IOException {
  Server server=createJettyServer();
  Handler handler=createHandler();
  server.setHandler(handler);
  try {
    server.start();
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * @throws IOException 
 * @throws RuntimeException a wrapper of the possible{@link java.lang.Exception} that Jetty can throw at start-up
 */
public void start() throws IOException {
  server=createJettyServer();
  Handler handler=createHandler();
  server.setHandler(handler);
  try {
    server.start();
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}
Program: 152638
Project: 152638
Buggy source:
public void write(Stanza stanza){
  Renderer renderer=new Renderer(stanza);
  String xml;
  if ("String_Node_Str".equals(stanza.getName()) && NamespaceURIs.HTTP_ETHERX_JABBER_ORG_STREAMS.equals(stanza.getNamespaceURI())) {
    xml=renderer.getOpeningElement() + renderer.getElementContent();
  }
 else {
    xml=renderer.getComplete();
  }
  try {
    LOG.info("String_Node_Str" + xml);
    outbound.sendMessage(xml);
  }
 catch (  IOException e) {
    endSession(SessionTerminationCause.CONNECTION_ABORT);
  }
}

Fixed version (ground truth):
public void write(Stanza stanza){
  Renderer renderer=new Renderer(stanza);
  if ("String_Node_Str".equals(stanza.getName()) && NamespaceURIs.HTTP_ETHERX_JABBER_ORG_STREAMS.equals(stanza.getNamespaceURI())) {
    send(renderer.getOpeningElement());
    send(renderer.getElementContent());
  }
 else {
    send(renderer.getComplete());
  }
}
Program: 152639
Project: 152639
Buggy source:
public void relay(Entity receiver,Stanza stanza,DeliveryFailureStrategy deliveryFailureStrategy) throws DeliveryException {
  boolean toServerTLD=receiver == null || (!receiver.isNodeSet() && EntityUtils.isAddressingServer(receiver,serverRuntimeContext.getServerEnitity()));
  boolean toComponent=!toServerTLD && !receiver.isNodeSet();
  if (toServerTLD) {
    throw new RuntimeException("String_Node_Str");
  }
  boolean relayToExternal=serverRuntimeContext.getServerFeatures().isRelayingToFederationServers();
  if (EntityUtils.isAddressingServerComponent(receiver,serverRuntimeContext.getServerEnitity()) || toComponent) {
    internalRelay.relay(receiver,stanza,deliveryFailureStrategy);
  }
 else {
    if (!relayToExternal)     throw new IllegalStateException("String_Node_Str");
    externalRelay.relay(receiver,stanza,deliveryFailureStrategy);
  }
}

Fixed version (ground truth):
public void relay(Entity receiver,Stanza stanza,DeliveryFailureStrategy deliveryFailureStrategy) throws DeliveryException {
  boolean toServerTLD=receiver == null || (!receiver.isNodeSet() && EntityUtils.isAddressingServer(receiver,serverRuntimeContext.getServerEnitity()));
  boolean toComponent=EntityUtils.isAddressingServerComponent(receiver,serverRuntimeContext.getServerEnitity());
  if (toServerTLD) {
    throw new RuntimeException("String_Node_Str");
  }
  boolean relayToExternal=serverRuntimeContext.getServerFeatures().isRelayingToFederationServers();
  if (EntityUtils.isAddressingServer(receiver,serverRuntimeContext.getServerEnitity()) || toComponent) {
    internalRelay.relay(receiver,stanza,deliveryFailureStrategy);
  }
 else {
    if (!relayToExternal)     throw new IllegalStateException("String_Node_Str");
    externalRelay.relay(receiver,stanza,deliveryFailureStrategy);
  }
}
Program: 152640
Project: 152640
Buggy source:
/** 
 * Creates the stanza for notifying the subscriber including payload.
 * @param from the node JID which sends the notification
 * @param to the receiver of the notification (subscriber)
 * @param lang the language of the stanza text-content.
 * @param item the payload as XMLElement
 * @return the prepared Stanza object.
 */
private Stanza createMessageEventStanza(String nodeName,Entity to,String lang,XMLElement item){
  StanzaBuilder stanzaBuilder=new StanzaBuilder("String_Node_Str",NamespaceURIs.XEP0060_PUBSUB_EVENT);
  stanzaBuilder.addAttribute("String_Node_Str",serverJID.getFullQualifiedName());
  stanzaBuilder.addAttribute("String_Node_Str",to.getFullQualifiedName());
  stanzaBuilder.addAttribute(NamespaceURIs.XML,"String_Node_Str",lang);
  stanzaBuilder.startInnerElement("String_Node_Str",NamespaceURIs.XEP0060_PUBSUB_EVENT);
  stanzaBuilder.startInnerElement("String_Node_Str",NamespaceURIs.XEP0060_PUBSUB_EVENT);
  stanzaBuilder.addAttribute("String_Node_Str",nodeName);
  stanzaBuilder.addPreparedElement(item);
  stanzaBuilder.endInnerElement();
  stanzaBuilder.endInnerElement();
  return stanzaBuilder.build();
}

Fixed version (ground truth):
/** 
 * Creates the stanza for notifying the subscriber including payload.
 * @param from the node JID which sends the notification
 * @param to the receiver of the notification (subscriber)
 * @param lang the language of the stanza text-content.
 * @param item the payload as XMLElement
 * @return the prepared Stanza object.
 */
private Stanza createMessageEventStanza(String nodeName,Entity to,String lang,XMLElement item){
  StanzaBuilder stanzaBuilder=new StanzaBuilder("String_Node_Str",NamespaceURIs.JABBER_CLIENT);
  stanzaBuilder.addAttribute("String_Node_Str",serverJID.getFullQualifiedName());
  stanzaBuilder.addAttribute("String_Node_Str",to.getFullQualifiedName());
  stanzaBuilder.addAttribute(NamespaceURIs.XML,"String_Node_Str",lang);
  stanzaBuilder.startInnerElement("String_Node_Str",NamespaceURIs.XEP0060_PUBSUB_EVENT);
  stanzaBuilder.startInnerElement("String_Node_Str",NamespaceURIs.XEP0060_PUBSUB_EVENT);
  stanzaBuilder.addAttribute("String_Node_Str",nodeName);
  stanzaBuilder.addPreparedElement(item);
  stanzaBuilder.endInnerElement();
  stanzaBuilder.endInnerElement();
  return stanzaBuilder.build();
}
Program: 152642
Project: 152642
Buggy source:
private void characters(String s) throws SAXException {
  if (!elements.isEmpty()) {
    String unescaped=unescape(s);
    log.trace("String_Node_Str",unescaped);
    contentHandler.characters(unescaped.toCharArray(),0,unescaped.length());
  }
 else {
    startDocument();
    fatalError("String_Node_Str");
  }
}

Fixed version (ground truth):
private void characters(String s) throws SAXException {
  if (!elements.isEmpty()) {
    String unescaped=unescape(s);
    log.trace("String_Node_Str",unescaped);
    contentHandler.characters(unescaped.toCharArray(),0,unescaped.length());
  }
 else   if (s.trim().length() > 0) {
    startDocument();
    fatalError("String_Node_Str");
  }
 else {
    startDocument();
  }
}
Program: 152643
Project: 152643
Buggy source:
protected void assertStartDocument(TestEvent actual){
  if (!(actual instanceof StartDocumentEvent))   fail("String_Node_Str" + actual.getClass());
}

Fixed version (ground truth):
protected void assertStartDocument(TestEvent actual){
  printIfFatal(actual);
  if (!(actual instanceof StartDocumentEvent))   fail("String_Node_Str" + actual.getClass());
}
Program: 152644
Project: 152644
Buggy source:
protected void assertEndDocument(TestEvent actual){
  if (!(actual instanceof EndDocumentEvent))   fail("String_Node_Str");
}

Fixed version (ground truth):
protected void assertEndDocument(TestEvent actual){
  printIfFatal(actual);
  if (!(actual instanceof EndDocumentEvent))   fail("String_Node_Str");
}
Program: 152645
Project: 152645
Buggy source:
protected void assertText(String expected,TestEvent actual){
  if (!(actual instanceof CharacterEvent))   fail("String_Node_Str");
  assertEquals(expected,((CharacterEvent)actual).getCharacters());
}

Fixed version (ground truth):
protected void assertText(String expected,TestEvent actual){
  printIfFatal(actual);
  if (!(actual instanceof CharacterEvent))   fail("String_Node_Str");
  assertEquals(expected,((CharacterEvent)actual).getCharacters());
}
Program: 152646
Project: 152646
Buggy source:
protected void assertStartElement(String expectedUri,String expectedLocalName,String expectedQName,Attributes expectedAttributes,TestEvent actual){
  if (!(actual instanceof StartElementEvent))   fail("String_Node_Str" + actual.getClass());
  StartElementEvent startElementEvent=(StartElementEvent)actual;
  assertEquals("String_Node_Str",expectedUri,startElementEvent.getURI());
  assertEquals("String_Node_Str",expectedLocalName,startElementEvent.getLocalName());
  assertEquals("String_Node_Str",expectedQName,startElementEvent.getQName());
  assertAttributes(expectedAttributes,startElementEvent.getAtts());
}

Fixed version (ground truth):
protected void assertStartElement(String expectedUri,String expectedLocalName,String expectedQName,Attributes expectedAttributes,TestEvent actual){
  printIfFatal(actual);
  if (!(actual instanceof StartElementEvent))   fail("String_Node_Str" + actual.getClass());
  StartElementEvent startElementEvent=(StartElementEvent)actual;
  assertEquals("String_Node_Str",expectedUri,startElementEvent.getURI());
  assertEquals("String_Node_Str",expectedLocalName,startElementEvent.getLocalName());
  assertEquals("String_Node_Str",expectedQName,startElementEvent.getQName());
  assertAttributes(expectedAttributes,startElementEvent.getAtts());
}
Program: 152647
Project: 152647
Buggy source:
protected void assertEndElement(String expectedUri,String expectedLocalName,String expectedQName,TestEvent actual){
  if (!(actual instanceof EndElementEvent))   fail("String_Node_Str");
  EndElementEvent endElementEvent=(EndElementEvent)actual;
  assertEquals("String_Node_Str",expectedUri,endElementEvent.getURI());
  assertEquals("String_Node_Str",expectedLocalName,endElementEvent.getLocalName());
  assertEquals("String_Node_Str",expectedQName,endElementEvent.getQName());
}

Fixed version (ground truth):
protected void assertEndElement(String expectedUri,String expectedLocalName,String expectedQName,TestEvent actual){
  printIfFatal(actual);
  if (!(actual instanceof EndElementEvent))   fail("String_Node_Str");
  EndElementEvent endElementEvent=(EndElementEvent)actual;
  assertEquals("String_Node_Str",expectedUri,endElementEvent.getURI());
  assertEquals("String_Node_Str",expectedLocalName,endElementEvent.getLocalName());
  assertEquals("String_Node_Str",expectedQName,endElementEvent.getQName());
}
Program: 152648
Project: 152648
Buggy source:
public Map<String,String> getNamespaceDeclarations(){
  Map<String,String> ns=new HashMap<String,String>();
  if (!elements.isEmpty()) {
    XMLElement topElm=elements.peek();
    for (    Attribute attribute : topElm.getAttributes()) {
      if (attribute instanceof NamespaceAttribute) {
        NamespaceAttribute nsAttr=(NamespaceAttribute)attribute;
        ns.put(nsAttr.getPrefix(),nsAttr.getValue());
      }
    }
    for (    Attribute attribute : topElm.getAttributes()) {
      if (!(attribute instanceof NamespaceAttribute)) {
        String attrNs=attribute.getNamespaceUri();
        if (attrNs.length() > 0 && resolvePrefix(attrNs,false) == null) {
          ns.put(resolvePrefix(attrNs),attrNs);
        }
      }
    }
    if (topElm.getNamespaceURI().length() > 0) {
      if (!ns.containsValue(topElm.getNamespaceURI())) {
        pop();
        if (resolvePrefix(topElm.getNamespaceURI(),false) == null) {
          ns.put(topElm.getNamespacePrefix(),topElm.getNamespaceURI());
        }
        push(topElm);
      }
    }
  }
  return ns;
}

Fixed version (ground truth):
public Map<String,String> getNamespaceDeclarations(){
  Map<String,String> ns=new HashMap<String,String>();
  if (!elements.isEmpty()) {
    XMLElement topElm=elements.peek();
    for (    Attribute attribute : topElm.getAttributes()) {
      if (attribute instanceof NamespaceAttribute) {
        NamespaceAttribute nsAttr=(NamespaceAttribute)attribute;
        ns.put(nsAttr.getPrefix(),nsAttr.getValue());
      }
    }
    for (    Attribute attribute : topElm.getAttributes()) {
      if (!(attribute instanceof NamespaceAttribute)) {
        String attrNs=attribute.getNamespaceUri();
        if (attrNs.length() > 0 && resolvePrefix(attrNs,false) == null) {
          ns.put(resolvePrefix(attrNs),attrNs);
        }
      }
    }
    if (topElm.getNamespaceURI().length() > 0) {
      if (!ns.containsValue(topElm.getNamespaceURI())) {
        pop();
        if (resolvePrefix(topElm.getNamespaceURI(),false) == null) {
          ns.put(topElm.getNamespacePrefix(),topElm.getNamespaceURI());
        }
        push(topElm);
      }
    }
 else {
      if (elements.size() > 1 && elements.get(elements.size() - 2).getNamespaceURI().length() > 0 && !ns.containsKey("String_Node_Str")) {
        ns.put("String_Node_Str","String_Node_Str");
      }
    }
  }
  return ns;
}
Program: 152649
Project: 152649
Buggy source:
private void renderAttribute(StringBuilder buffer,Attribute attribute){
  buffer.append(attribute.getName()).append("String_Node_Str").append(attribute.getValue()).append("String_Node_Str");
}

Fixed version (ground truth):
private void renderAttribute(StringBuilder buffer,Attribute attribute){
  buffer.append(attribute.getName()).append("String_Node_Str").append(escapeAttributeValue(attribute.getValue())).append("String_Node_Str");
}
Program: 152650
Project: 152650
Buggy source:
/** 
 * @return
 */
@SpecCompliant(spec="String_Node_Str",section="String_Node_Str",status=SpecCompliant.ComplianceStatus.IN_PROGRESS,coverage=SpecCompliant.ComplianceCoverage.COMPLETE) protected RelayResult deliver(){
  try {
    String receiverDomain=receiver.getDomain();
    if (receiverDomain != null && !receiverDomain.equals(serverEntity.getDomain())) {
      if (serverRuntimeContext == null) {
        return new RelayResult(new ServiceNotAvailableException("String_Node_Str"));
      }
      if (!receiverDomain.endsWith("String_Node_Str" + serverEntity.getDomain())) {
        return new RelayResult(new ServiceNotAvailableException("String_Node_Str" + receiverDomain));
      }
      StanzaProcessor processor=serverRuntimeContext.getComponentStanzaProcessor(receiverDomain);
      if (processor == null) {
        return new RelayResult(new ServiceNotAvailableException("String_Node_Str" + receiverDomain));
      }
      processor.processStanza(serverRuntimeContext,null,stanza,null);
    }
    if (receiver.isResourceSet()) {
      return deliverToFullJID();
    }
 else {
      return deliverToBareJID();
    }
  }
 catch (  RuntimeException e) {
    return new RelayResult(new DeliveryException(e));
  }
}

Fixed version (ground truth):
/** 
 * @return
 */
@SpecCompliant(spec="String_Node_Str",section="String_Node_Str",status=SpecCompliant.ComplianceStatus.IN_PROGRESS,coverage=SpecCompliant.ComplianceCoverage.COMPLETE) protected RelayResult deliver(){
  try {
    String receiverDomain=receiver.getDomain();
    if (receiverDomain != null && !receiverDomain.equals(serverEntity.getDomain())) {
      if (serverRuntimeContext == null) {
        return new RelayResult(new ServiceNotAvailableException("String_Node_Str"));
      }
      if (!receiverDomain.endsWith("String_Node_Str" + serverEntity.getDomain())) {
        return new RelayResult(new ServiceNotAvailableException("String_Node_Str" + receiverDomain));
      }
      StanzaProcessor processor=serverRuntimeContext.getComponentStanzaProcessor(receiverDomain);
      if (processor == null) {
        return new RelayResult(new ServiceNotAvailableException("String_Node_Str" + receiverDomain));
      }
      processor.processStanza(serverRuntimeContext,null,stanza,null);
      return new RelayResult();
    }
    if (receiver.isResourceSet()) {
      return deliverToFullJID();
    }
 else {
      return deliverToBareJID();
    }
  }
 catch (  RuntimeException e) {
    return new RelayResult(new DeliveryException(e));
  }
}
Program: 152651
Project: 152651
Buggy source:
@SpecCompliant(spec="String_Node_Str",section="String_Node_Str",status=SpecCompliant.ComplianceStatus.IN_PROGRESS,coverage=SpecCompliant.ComplianceCoverage.COMPLETE) private RelayResult deliverToBareJID(){
  XMPPCoreStanza xmppStanza=XMPPCoreStanza.getWrapper(stanza);
  if (xmppStanza == null)   new RelayResult(new DeliveryException("String_Node_Str"));
  if (PresenceStanza.isOfType(stanza)) {
    return relayToAllSessions();
  }
 else   if (MessageStanza.isOfType(stanza)) {
    MessageStanza messageStanza=(MessageStanza)xmppStanza;
    MessageStanzaType messageStanzaType=messageStanza.getMessageType();
switch (messageStanzaType) {
case CHAT:
case NORMAL:
      return relayToBestSession(false);
case ERROR:
    return null;
case GROUPCHAT:
  return new RelayResult(new ServiceNotAvailableException());
case HEADLINE:
return relayToAllSessions();
default :
throw new RuntimeException("String_Node_Str" + messageStanzaType.value());
}
}
 else if (IQStanza.isOfType(stanza)) {
throw new RuntimeException("String_Node_Str");
}
return relayNotPossible();
}

Fixed version (ground truth):
@SpecCompliant(spec="String_Node_Str",section="String_Node_Str",status=SpecCompliant.ComplianceStatus.IN_PROGRESS,coverage=SpecCompliant.ComplianceCoverage.COMPLETE) private RelayResult deliverToBareJID(){
  XMPPCoreStanza xmppStanza=XMPPCoreStanza.getWrapper(stanza);
  if (xmppStanza == null)   return new RelayResult(new DeliveryException("String_Node_Str"));
  if (PresenceStanza.isOfType(stanza)) {
    return relayToAllSessions();
  }
 else   if (MessageStanza.isOfType(stanza)) {
    MessageStanza messageStanza=(MessageStanza)xmppStanza;
    MessageStanzaType messageStanzaType=messageStanza.getMessageType();
switch (messageStanzaType) {
case CHAT:
case NORMAL:
      return relayToBestSession(false);
case ERROR:
    return null;
case GROUPCHAT:
  return new RelayResult(new ServiceNotAvailableException());
case HEADLINE:
return relayToAllSessions();
default :
throw new RuntimeException("String_Node_Str" + messageStanzaType.value());
}
}
 else if (IQStanza.isOfType(stanza)) {
throw new RuntimeException("String_Node_Str");
}
return relayNotPossible();
}
Program: 152652
Project: 152652
Buggy source:
public boolean onlySubelementEquals(String name,String namespaceURI){
  List<XMLFragment> innerFragments=element.getInnerFragments();
  if (innerFragments == null || innerFragments.size() != 1)   return false;
  XMLFragment onlySubelement=innerFragments.get(0);
  if (!(onlySubelement instanceof XMLElement))   return false;
  XMLElement xmlElement=((XMLElement)onlySubelement);
  boolean nameEquals=name == null ? xmlElement.getName() == null : name.equals(xmlElement.getName());
  if (namespaceURI == null)   namespaceURI=NamespaceAttribute.DEFAULT_NAMESPACE;
  return nameEquals && namespaceURI.equals(xmlElement.getNamespacePrefix());
}

Fixed version (ground truth):
public boolean onlySubelementEquals(String name,String namespaceURI){
  List<XMLFragment> innerFragments=element.getInnerFragments();
  if (innerFragments == null || innerFragments.size() != 1)   return false;
  XMLFragment onlySubelement=innerFragments.get(0);
  if (!(onlySubelement instanceof XMLElement))   return false;
  XMLElement xmlElement=((XMLElement)onlySubelement);
  boolean nameEquals=name == null ? xmlElement.getName() == null : name.equals(xmlElement.getName());
  if (namespaceURI == null)   namespaceURI=NamespaceAttribute.DEFAULT_NAMESPACE;
  return nameEquals && namespaceURI.equals(xmlElement.getNamespaceURI());
}
Program: 152653
Project: 152653
Buggy source:
/** 
 * blocking operation until next stanza is ready
 * @return
 * @throws ParsingException
 */
public Stanza getNextStanza() throws ParsingException {
  if (parser == null)   open();
  XMLEvent event=null;
  while (true) {
    event=getNextXMLEvent();
    if (event == null)     return null;
    if (event.type == XMLEvent.DOCUMENT && !((DocumentEvent)event).start)     return null;
    if (event.type == XMLEvent.PREFIX_MAPPING) {
      PrefixMappingEvent prefixMappingEvent=(PrefixMappingEvent)event;
      String prefix=prefixMappingEvent.prefix;
      if (prefixesToNamespace.containsKey(prefix)) {
        throw new IllegalStateException("String_Node_Str" + prefix);
      }
      prefixesToNamespace.put(prefix,prefixMappingEvent.uri);
    }
    if (event.type == XMLEvent.ELEMENT)     break;
  }
  ElementEvent startElementEvent=(ElementEvent)event;
  if (!startElementEvent.start)   throw new ParsingException("String_Node_Str" + startElementEvent.element.rawname);
  String namespaceURI=resolveNamespace(startElementEvent);
  String name=startElementEvent.element.localpart;
  if (DEFAULT_OPENING_XML_ELEMENT_NAME.equals(name))   return getNextStanza();
  List<Attribute> stanzaAttributes=fillAttributesFromXML(startElementEvent);
  List<XMLFragment> xmlFragments=new ArrayList<XMLFragment>();
  if (!"String_Node_Str".equals(name)) {
    if (!fillDeep(startElementEvent.element.rawname,xmlFragments))     throw new ParsingException("String_Node_Str");
  }
  return new Stanza(name,namespaceURI,stanzaAttributes,xmlFragments);
}

Fixed version (ground truth):
/** 
 * blocking operation until next stanza is ready
 * @return
 * @throws ParsingException
 */
public Stanza getNextStanza() throws ParsingException {
  if (parser == null)   open();
  XMLEvent event=null;
  while (true) {
    event=getNextXMLEvent();
    if (event == null)     return null;
    if (event.type == XMLEvent.DOCUMENT && !((DocumentEvent)event).start)     return null;
    if (event.type == XMLEvent.PREFIX_MAPPING) {
      PrefixMappingEvent prefixMappingEvent=(PrefixMappingEvent)event;
      String prefix=prefixMappingEvent.prefix;
      if (prefixesToNamespace.containsKey(prefix)) {
        throw new IllegalStateException("String_Node_Str" + prefix);
      }
      prefixesToNamespace.put(prefix,prefixMappingEvent.uri);
    }
    if (event.type == XMLEvent.ELEMENT)     break;
  }
  ElementEvent startElementEvent=(ElementEvent)event;
  if (!startElementEvent.start)   throw new ParsingException("String_Node_Str" + startElementEvent.element.rawname);
  String namespaceURI=resolveNamespace(startElementEvent);
  String name=startElementEvent.element.localpart;
  if (DEFAULT_OPENING_XML_ELEMENT_NAME.equals(name))   return getNextStanza();
  List<Attribute> stanzaAttributes=fillAttributesFromXML(startElementEvent);
  List<XMLFragment> xmlFragments=new ArrayList<XMLFragment>();
  if (!"String_Node_Str".equals(name)) {
    if (!fillDeep(startElementEvent.element.rawname,xmlFragments))     throw new ParsingException("String_Node_Str");
  }
  return new Stanza(name,null,stanzaAttributes,xmlFragments);
}