nus-yam/ex-repair huggingface dataset:
Program: 79434
Project: 79434
Buggy source:
public static void preRegister(final Context context,final String programName,final PrintWriter errWriter,final PrintWriter warnWriter,final PrintWriter noticeWriter){
  context.put(logKey,new Context.Factory<Log>(){
    public Log make(){
      return new Messager(context,programName,errWriter,warnWriter,noticeWriter);
    }
  }
);
}

Fixed version (ground truth):
public static void preRegister(Context context,final String programName,final PrintWriter errWriter,final PrintWriter warnWriter,final PrintWriter noticeWriter){
  context.put(logKey,new Context.Factory<Log>(){
    public Log make(    Context c){
      return new Messager(c,programName,errWriter,warnWriter,noticeWriter);
    }
  }
);
}
Program: 79435
Project: 79435
Buggy source:
public JavacMessages make(){
  return new ArgTypeMessages(c){
    @Override public String getLocalizedString(    Locale l,    String key,    Object... args){
      return getKeyArgsString(key,args);
    }
  }
;
}

Fixed version (ground truth):
public JavacMessages make(Context c){
  return new ArgTypeMessages(c){
    @Override public String getLocalizedString(    Locale l,    String key,    Object... args){
      return getKeyArgsString(key,args);
    }
  }
;
}
Program: 79436
Project: 79436
Buggy source:
static void preRegister(final Context c){
  c.put(JavacMessages.messagesKey,new Context.Factory<JavacMessages>(){
    public JavacMessages make(){
      return new ArgTypeMessages(c){
        @Override public String getLocalizedString(        Locale l,        String key,        Object... args){
          return getKeyArgsString(key,args);
        }
      }
;
    }
  }
);
}

Fixed version (ground truth):
static void preRegister(Context context){
  context.put(JavacMessages.messagesKey,new Context.Factory<JavacMessages>(){
    public JavacMessages make(    Context c){
      return new ArgTypeMessages(c){
        @Override public String getLocalizedString(        Locale l,        String key,        Object... args){
          return getKeyArgsString(key,args);
        }
      }
;
    }
  }
);
}
Program: 79437
Project: 79437
Buggy source:
public JavacMessages make(){
  return new MessageTracker(c){
    @Override public String getLocalizedString(    Locale l,    String key,    Object... args){
      keys.add(key);
      return super.getLocalizedString(l,key,args);
    }
  }
;
}

Fixed version (ground truth):
public JavacMessages make(Context c){
  return new MessageTracker(c){
    @Override public String getLocalizedString(    Locale l,    String key,    Object... args){
      keys.add(key);
      return super.getLocalizedString(l,key,args);
    }
  }
;
}
Program: 79438
Project: 79438
Buggy source:
static void preRegister(final Context c,final Set<String> keys){
  if (keys != null) {
    c.put(JavacMessages.messagesKey,new Context.Factory<JavacMessages>(){
      public JavacMessages make(){
        return new MessageTracker(c){
          @Override public String getLocalizedString(          Locale l,          String key,          Object... args){
            keys.add(key);
            return super.getLocalizedString(l,key,args);
          }
        }
;
      }
    }
);
  }
}

Fixed version (ground truth):
static void preRegister(Context c,final Set<String> keys){
  if (keys != null) {
    c.put(JavacMessages.messagesKey,new Context.Factory<JavacMessages>(){
      public JavacMessages make(      Context c){
        return new MessageTracker(c){
          @Override public String getLocalizedString(          Locale l,          String key,          Object... args){
            keys.add(key);
            return super.getLocalizedString(l,key,args);
          }
        }
;
      }
    }
);
  }
}
Program: 79439
Project: 79439
Buggy source:
public Entry next(){
  Entry e=super.shadowed;
  while (e.scope != null && (e.sym.name != sym.name || e.sym.owner != e.scope.owner))   e=e.shadowed;
  return e;
}

Fixed version (ground truth):
public Entry next(){
  Entry e=super.shadowed;
  while (isBogus())   e=e.shadowed;
  return e;
}
Program: 79440
Project: 79440
Buggy source:
protected Scope(Symbol owner,ScopeCounter scopeCounter){
  this(null,owner,new Entry[INITIAL_SIZE],scopeCounter);
  for (int i=0; i < INITIAL_SIZE; i++)   table[i]=sentinel;
}

Fixed version (ground truth):
protected Scope(Symbol owner,ScopeCounter scopeCounter){
  this(null,owner,new Entry[INITIAL_SIZE],scopeCounter);
}
Program: 79441
Project: 79441
Buggy source:
protected Scope(Symbol owner,ScopeCounter scopeCounter){
  this(null,owner,new Entry[INITIAL_SIZE],scopeCounter);
}

Fixed version (ground truth):
protected Scope(Symbol owner,ScopeCounter scopeCounter){
  this(null,owner,new Entry[INITIAL_SIZE],scopeCounter);
  for (int i=0; i < INITIAL_SIZE; i++)   table[i]=sentinel;
}
Program: 79442
Project: 79442
Buggy source:
@Override public void write(int b) throws IOException {
  size++;
}

Fixed version (ground truth):
@Override public void write(int b){
  size++;
}
Program: 79443
Project: 79443
Buggy source:
public int byteLength(){
class SizeOutputStream extends OutputStream {
    @Override public void write(    int b) throws IOException {
      size++;
    }
    int size;
  }
  SizeOutputStream sizeOut=new SizeOutputStream();
  DataOutputStream out=new DataOutputStream(sizeOut);
  try {
    out.writeUTF(value);
  }
 catch (  IOException ignore) {
  }
  return 1 + sizeOut.size;
}

Fixed version (ground truth):
public int byteLength(){
class SizeOutputStream extends OutputStream {
    @Override public void write(    int b){
      size++;
    }
    int size;
  }
  SizeOutputStream sizeOut=new SizeOutputStream();
  DataOutputStream out=new DataOutputStream(sizeOut);
  try {
    out.writeUTF(value);
  }
 catch (  IOException ignore) {
  }
  return 1 + sizeOut.size;
}
Program: 79444
Project: 79444
Buggy source:
/** 
 * Constructor
 * @param context      Context for this javadoc instance.
 */
private DocEnv(Context context){
  context.put(docEnvKey,this);
  messager=Messager.instance0(context);
  syms=Symtab.instance(context);
  reader=JavadocClassReader.instance0(context);
  enter=JavadocEnter.instance0(context);
  attr=Attr.instance(context);
  names=Names.instance(context);
  externalizableSym=reader.enterClass(names.fromString("String_Node_Str"));
  chk=Check.instance(context);
  types=Types.instance(context);
  fileManager=context.get(JavaFileManager.class);
  this.doclocale=new DocLocale(this,"String_Node_Str",breakiterator);
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param context      Context for this javadoc instance.
 */
private DocEnv(Context context){
  context.put(docEnvKey,this);
  messager=Messager.instance0(context);
  syms=Symtab.instance(context);
  reader=JavadocClassReader.instance0(context);
  enter=JavadocEnter.instance0(context);
  names=Names.instance(context);
  externalizableSym=reader.enterClass(names.fromString("String_Node_Str"));
  chk=Check.instance(context);
  types=Types.instance(context);
  fileManager=context.get(JavaFileManager.class);
  this.doclocale=new DocLocale(this,"String_Node_Str",breakiterator);
}
Program: 79445
Project: 79445
Buggy source:
/** 
 * Default class enter visitor method: do nothing.
 */
public void visitTree(JCTree tree){
  result=null;
}

Fixed version (ground truth):
/** 
 * Default class enter visitor method: do nothing.
 */
@Override public void visitTree(JCTree tree){
  result=null;
}
Program: 79448
Project: 79448
Buggy source:
/** 
 * Class enter visitor method for type parameters. Enter a symbol for type parameter in local scope, after checking that it is unique.
 */
public void visitTypeParameter(JCTypeParameter tree){
  TypeVar a=(tree.type != null) ? (TypeVar)tree.type : new TypeVar(tree.name,env.info.scope.owner,syms.botType);
  tree.type=a;
  if (chk.checkUnique(tree.pos(),a.tsym,env.info.scope)) {
    env.info.scope.enter(a.tsym);
  }
  result=a;
}

Fixed version (ground truth):
/** 
 * Class enter visitor method for type parameters. Enter a symbol for type parameter in local scope, after checking that it is unique.
 */
@Override public void visitTypeParameter(JCTypeParameter tree){
  TypeVar a=(tree.type != null) ? (TypeVar)tree.type : new TypeVar(tree.name,env.info.scope.owner,syms.botType);
  tree.type=a;
  if (chk.checkUnique(tree.pos(),a.tsym,env.info.scope)) {
    env.info.scope.enter(a.tsym);
  }
  result=a;
}
Program: 79449
Project: 79449
Buggy source:
/** 
 * Main method: enter one class from a list of toplevel trees and place the rest on uncompleted for later processing.
 * @param trees      The list of trees to be processed.
 * @param c          The class symbol to be processed.
 */
public void complete(List<JCCompilationUnit> trees,ClassSymbol c){
  annotate.enterStart();
  ListBuffer<ClassSymbol> prevUncompleted=uncompleted;
  if (memberEnter.completionEnabled)   uncompleted=new ListBuffer<ClassSymbol>();
  try {
    classEnter(trees,null);
    if (memberEnter.completionEnabled) {
      while (uncompleted.nonEmpty()) {
        ClassSymbol clazz=uncompleted.next();
        if (c == null || c == clazz || prevUncompleted == null)         clazz.complete();
 else         prevUncompleted.append(clazz);
      }
      for (      JCCompilationUnit tree : trees) {
        if (tree.starImportScope.elems == null) {
          JavaFileObject prev=log.useSource(tree.sourcefile);
          Env<AttrContext> env=typeEnvs.get(tree);
          if (env == null)           env=topLevelEnv(tree);
          memberEnter.memberEnter(tree,env);
          log.useSource(prev);
        }
      }
    }
  }
  finally {
    uncompleted=prevUncompleted;
    annotate.enterDone();
  }
}

Fixed version (ground truth):
/** 
 * Main method: enter one class from a list of toplevel trees and place the rest on uncompleted for later processing.
 * @param trees      The list of trees to be processed.
 * @param c          The class symbol to be processed.
 */
public void complete(List<JCCompilationUnit> trees,ClassSymbol c){
  annotate.enterStart();
  ListBuffer<ClassSymbol> prevUncompleted=uncompleted;
  if (memberEnter.completionEnabled)   uncompleted=new ListBuffer<ClassSymbol>();
  try {
    classEnter(trees,null);
    if (memberEnter.completionEnabled) {
      while (uncompleted.nonEmpty()) {
        ClassSymbol clazz=uncompleted.next();
        if (c == null || c == clazz || prevUncompleted == null)         clazz.complete();
 else         prevUncompleted.append(clazz);
      }
      for (      JCCompilationUnit tree : trees) {
        if (tree.starImportScope.elems == null) {
          JavaFileObject prev=log.useSource(tree.sourcefile);
          Env<AttrContext> topEnv=topLevelEnv(tree);
          memberEnter.memberEnter(tree,topEnv);
          log.useSource(prev);
        }
      }
    }
  }
  finally {
    uncompleted=prevUncompleted;
    annotate.enterDone();
  }
}
Program: 79450
Project: 79450
Buggy source:
public void visitNewArray(JCNewArray tree){
  tree.elemtype=translate(tree.elemtype,null);
  translate(tree.dims,syms.intType);
  tree.elems=translate(tree.elems,(tree.type == null) ? null : erasure(types.elemtype(tree.type)));
  tree.type=erasure(tree.type);
  result=tree;
}

Fixed version (ground truth):
public void visitNewArray(JCNewArray tree){
  tree.elemtype=translate(tree.elemtype,null);
  translate(tree.dims,syms.intType);
  if (tree.type != null) {
    tree.elems=translate(tree.elems,erasure(types.elemtype(tree.type)));
    tree.type=erasure(tree.type);
  }
 else {
    tree.elems=translate(tree.elems,null);
  }
  result=tree;
}
Program: 79451
Project: 79451
Buggy source:
/** 
 * A KindName representing a given symbol
 */
public static KindName kindName(Symbol sym){
switch (sym.getKind()) {
case PACKAGE:
    return KindName.PACKAGE;
case ENUM:
case ANNOTATION_TYPE:
case INTERFACE:
case CLASS:
  return KindName.CLASS;
case TYPE_PARAMETER:
return KindName.TYPEVAR;
case ENUM_CONSTANT:
case FIELD:
case PARAMETER:
case LOCAL_VARIABLE:
case EXCEPTION_PARAMETER:
return KindName.VAR;
case METHOD:
case CONSTRUCTOR:
case STATIC_INIT:
case INSTANCE_INIT:
return KindName.METHOD;
default :
if (sym.kind == VAL) return KindName.VAL;
 else throw new AssertionError("String_Node_Str" + sym.getKind());
}
}

Fixed version (ground truth):
/** 
 * A KindName representing a given symbol
 */
public static KindName kindName(Symbol sym){
switch (sym.getKind()) {
case PACKAGE:
    return KindName.PACKAGE;
case ENUM:
  return KindName.ENUM;
case ANNOTATION_TYPE:
case CLASS:
return KindName.CLASS;
case INTERFACE:
return KindName.INTERFACE;
case TYPE_PARAMETER:
return KindName.TYPEVAR;
case ENUM_CONSTANT:
case FIELD:
case PARAMETER:
case LOCAL_VARIABLE:
case EXCEPTION_PARAMETER:
return KindName.VAR;
case CONSTRUCTOR:
return KindName.CONSTRUCTOR;
case METHOD:
case STATIC_INIT:
case INSTANCE_INIT:
return KindName.METHOD;
default :
if (sym.kind == VAL) return KindName.VAL;
 else throw new AssertionError("String_Node_Str" + sym.getKind());
}
}
Program: 79452
Project: 79452
Buggy source:
/** 
 * The number of errors reported so far.
 */
public int errorCount(){
  if (delegateCompiler != null && delegateCompiler != this)   return delegateCompiler.errorCount();
 else   return log.nerrors;
}

Fixed version (ground truth):
/** 
 * The number of errors reported so far.
 */
public int errorCount(){
  if (delegateCompiler != null && delegateCompiler != this)   return delegateCompiler.errorCount();
 else {
    if (werror && log.nerrors == 0 && log.nwarnings > 0) {
      log.error("String_Node_Str");
    }
  }
  return log.nerrors;
}
Program: 79456
Project: 79456
Buggy source:
/** 
 * Initializes an APRep object.
 * @param encoding a single DER-encoded value.
 * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
 * @exception IOException if an I/O error occurs while reading encoded data.
 * @exception KrbApErrException if the value read from the DER-encoded datastream does not match the pre-defined value.
 */
private void init(DerValue encoding) throws Asn1Exception, KrbApErrException, IOException {
  if (((encoding.getTag() & (byte)(0x1F)) != Krb5.KRB_AP_REP) || (encoding.isApplication() != true) || (encoding.isConstructed() != true))   throw new Asn1Exception(Krb5.ASN1_BAD_ID);
  DerValue der=encoding.getData().getDerValue();
  if (der.getTag() != DerValue.tag_Sequence)   throw new Asn1Exception(Krb5.ASN1_BAD_ID);
  DerValue subDer=der.getData().getDerValue();
  if ((subDer.getTag() & (byte)0x1F) != (byte)0x00)   throw new Asn1Exception(Krb5.ASN1_BAD_ID);
  pvno=subDer.getData().getBigInteger().intValue();
  if (pvno != Krb5.PVNO)   throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
  subDer=der.getData().getDerValue();
  if ((subDer.getTag() & (byte)0x1F) != (byte)0x01)   throw new Asn1Exception(Krb5.ASN1_BAD_ID);
  msgType=subDer.getData().getBigInteger().intValue();
  if (msgType != Krb5.KRB_AP_REP)   throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
  encPart=EncryptedData.parse(der.getData(),(byte)0x02,false);
  if (der.getData().available() > 0)   throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}

Fixed version (ground truth):
/** 
 * Initializes an APRep object.
 * @param encoding a single DER-encoded value.
 * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
 * @exception IOException if an I/O error occurs while reading encoded data.
 * @exception KrbApErrException if the value read from the DER-encoded datastream does not match the pre-defined value.
 */
private void init(DerValue encoding) throws Asn1Exception, KrbApErrException, IOException {
  if (((encoding.getTag() & (byte)(0x1F)) != Krb5.KRB_AP_REP) || (encoding.isApplication() != true) || (encoding.isConstructed() != true)) {
    throw new Asn1Exception(Krb5.ASN1_BAD_ID);
  }
  DerValue der=encoding.getData().getDerValue();
  if (der.getTag() != DerValue.tag_Sequence) {
    throw new Asn1Exception(Krb5.ASN1_BAD_ID);
  }
  DerValue subDer=der.getData().getDerValue();
  if ((subDer.getTag() & (byte)0x1F) != (byte)0x00) {
    throw new Asn1Exception(Krb5.ASN1_BAD_ID);
  }
  pvno=subDer.getData().getBigInteger().intValue();
  if (pvno != Krb5.PVNO) {
    throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
  }
  subDer=der.getData().getDerValue();
  if ((subDer.getTag() & (byte)0x1F) != (byte)0x01) {
    throw new Asn1Exception(Krb5.ASN1_BAD_ID);
  }
  msgType=subDer.getData().getBigInteger().intValue();
  if (msgType != Krb5.KRB_AP_REP) {
    throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
  }
  encPart=EncryptedData.parse(der.getData(),(byte)0x02,false);
  if (der.getData().available() > 0) {
    throw new Asn1Exception(Krb5.ASN1_BAD_ID);
  }
}
Program: 79457
Project: 79457
Buggy source:
@Override public void run(){
  popupWindow=new PopupWindow(popupView,width,height,focusable);
  if (belowView) {
    popupWindow.showAsDropDown(rootView);
  }
 else {
    popupWindow.showAtLocation(rootView,gravity,0,0);
  }
}

Fixed version (ground truth):
public void run(){
  if (belowView) {
    popupWindow.showAsDropDown(rootView);
  }
 else {
    popupWindow.showAtLocation(rootView,gravity,0,0);
  }
}
Program: 79458
Project: 79458
Buggy source:
/** 
 * This method create a new popup window Implemented runnable to delay in order to avoid bad window token exception This method must be called after setLayout focusable default value is false
 */
public void setPopupWindow(){
  final android.os.Handler handler=new android.os.Handler();
  final int width=LinearLayout.LayoutParams.MATCH_PARENT;
  final int height=LinearLayout.LayoutParams.WRAP_CONTENT;
  handler.postDelayed(new Runnable(){
    @Override public void run(){
      popupWindow=new PopupWindow(popupView,width,height,focusable);
      if (belowView) {
        popupWindow.showAsDropDown(rootView);
      }
 else {
        popupWindow.showAtLocation(rootView,gravity,0,0);
      }
    }
  }
,delay);
}

Fixed version (ground truth):
/** 
 * This method create a new popup window Implemented runnable to delay in order to avoid bad window token exception This method must be called after setLayout focusable default value is false
 */
public void setPopupWindow(){
  final int width=LinearLayout.LayoutParams.MATCH_PARENT;
  final int height=LinearLayout.LayoutParams.WRAP_CONTENT;
  popupWindow=new PopupWindow(popupView,width,height,focusable);
  rootView.post(new Runnable(){
    public void run(){
      if (belowView) {
        popupWindow.showAsDropDown(rootView);
      }
 else {
        popupWindow.showAtLocation(rootView,gravity,0,0);
      }
    }
  }
);
}
Program: 79459
Project: 79459
Buggy source:
public Profile(String userId,String tenant,String email,Boolean isEmaildVerified,String name,String familyName,String givenName,Map<String,Object> claims){
  this.userId=userId;
  this.tenant=tenant;
  this.email=email;
  this.isEmaildVerified=isEmaildVerified;
  this.name=name;
  this.familyName=familyName;
  this.givenName=givenName;
  this.claims=claims;
}

Fixed version (ground truth):
/** 
 * Profile constructor.
 * @param userId of the user.
 * @param tenant of the user.
 * @param email of the user.
 * @param isEmaildVerified of the user.
 * @param name of the user.
 * @param familyName of the user.
 * @param givenName of the user.
 * @param claims  claims as key values.
 */
public Profile(String userId,String tenant,String email,Boolean isEmaildVerified,String name,String familyName,String givenName,Map<String,Object> claims){
  this.userId=userId;
  this.tenant=tenant;
  this.email=email;
  this.isEmaildVerified=isEmaildVerified;
  this.name=name;
  this.familyName=familyName;
  this.givenName=givenName;
  this.claims=claims;
}
Program: 79461
Project: 79461
Buggy source:
private Key retreiveKey(JwsHeader header,Claims claims){
  if (!keyResolver.isPresent()) {
    return null;
  }
  SignatureAlgorithm algorithm=SignatureAlgorithm.forName(header.getAlgorithm());
  JWTKeyResolver actualResolver=keyResolver.get();
  Map<String,Object> allClaims=Stream.of(claims,(Map<String,Object>)header).map(Map::entrySet).flatMap(Collection::stream).collect(Collectors.toMap(Map.Entry::getKey,Map.Entry::getValue));
  Optional<byte[]> keyBytes=actualResolver.resolve(allClaims);
  if (!keyBytes.isPresent()) {
    return null;
  }
  if (algorithm.isHmac()) {
    return new SecretKeySpec(keyBytes.get(),algorithm.getJcaName());
  }
  if (algorithm.isRsa() || algorithm.isEllipticCurve()) {
    try {
      return keyFactorySupplier.get(algorithm.getFamilyName()).get().generatePublic(new X509EncodedKeySpec(keyBytes.get()));
    }
 catch (    InvalidKeySpecException ex) {
      throw new RuntimeException(ex);
    }
  }
  throw new UnsupportedOperationException("String_Node_Str" + algorithm.getFamilyName() + "String_Node_Str");
}

Fixed version (ground truth):
private Key retreiveKey(JwsHeader header,Claims claims){
  if (!keyResolver.isPresent()) {
    return null;
  }
  SignatureAlgorithm algorithm=SignatureAlgorithm.forName(header.getAlgorithm());
  JwtKeyResolver actualResolver=keyResolver.get();
  Map<String,Object> allClaims=Stream.of(claims,(Map<String,Object>)header).map(Map::entrySet).flatMap(Collection::stream).collect(Collectors.toMap(Map.Entry::getKey,Map.Entry::getValue));
  Optional<byte[]> keyBytes=actualResolver.resolve(allClaims);
  if (!keyBytes.isPresent()) {
    return null;
  }
  if (algorithm.isHmac()) {
    return new SecretKeySpec(keyBytes.get(),algorithm.getJcaName());
  }
  if (algorithm.isRsa() || algorithm.isEllipticCurve()) {
    try {
      return keyFactorySupplier.get(algorithm.getFamilyName()).get().generatePublic(new X509EncodedKeySpec(keyBytes.get()));
    }
 catch (    InvalidKeySpecException ex) {
      throw new RuntimeException(ex);
    }
  }
  throw new UnsupportedOperationException("String_Node_Str" + algorithm.getFamilyName() + "String_Node_Str");
}
Program: 79462
Project: 79462
Buggy source:
private void connectToService(){
  serviceDisposable=activity.getSessionPublish().subscribe(service -> {
    if (course.getCurrentDay().getCurrentSentencePair() != null)     nextSentence(course.getCurrentDay().getCurrentSentencePair());
 else     sessionFinished(course.getCurrentDay());
    studySessionService=service;
    sentenceDisposable=studySessionService.sentenceObservable().subscribe(this::nextSentence);
    finishDisposable=studySessionService.finishObservable().subscribe(this::sessionFinished);
    setPaused(studySessionService.getPlaybackStatus() == StudySessionService.PlaybackStatus.PAUSED);
    if (!isPaused) {
      startTimer();
    }
    updateTime();
    updatePlayPauseImage();
  }
);
  activity.startSession(course.getCurrentDay());
}

Fixed version (ground truth):
private void connectToService(){
  serviceDisposable=activity.getSessionPublish().subscribe(service -> {
    if (course.getCurrentDay().getCurrentSentencePair() != null)     nextSentence(course.getCurrentDay().getCurrentSentencePair());
 else     sessionFinished(course.getCurrentDay());
    studySessionService=service;
    sentenceDisposable=studySessionService.sentenceObservable().subscribe(this::nextSentence);
    finishDisposable=studySessionService.finishObservable().subscribe(this::sessionFinished);
    setPaused(studySessionService.getPlaybackStatus() == null || studySessionService.getPlaybackStatus() == StudySessionService.PlaybackStatus.PAUSED);
    if (!isPaused) {
      startTimer();
    }
    updateTime();
    updatePlayPauseImage();
  }
);
  activity.startSession(course.getCurrentDay());
}
Program: 79463
Project: 79463
Buggy source:
@Override public int onStartCommand(Intent intent,int flags,int startId){
  if (intent.getExtras() == null)   stopSelf();
  realm=Realm.getDefaultInstance();
  String id=new Utils.Storage(getApplicationContext()).getDayId();
  if (day == null) {
    day=realm.where(Day.class).equalTo("String_Node_Str",id).findFirst();
    if (day == null)     stopSelf();
  }
  if (!requestAudioFocus())   stopSelf();
  if (mediaPlayer == null) {
    mediaPlayer=new MediaPlayer();
    mediaPlayer.setOnCompletionListener(this);
    mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
    loadSentence();
  }
  if (mediaSessionManager == null) {
    initMediaSession();
  }
  handleIncomingActions(intent);
  return super.onStartCommand(intent,flags,startId);
}

Fixed version (ground truth):
@Override public int onStartCommand(Intent intent,int flags,int startId){
  if (intent.getExtras() == null)   stopSelf();
  realm=Realm.getDefaultInstance();
  String id=new Utils.Storage(getApplicationContext()).getDayId();
  if (day == null) {
    day=realm.where(Day.class).equalTo("String_Node_Str",id).findFirst();
    if (day == null)     stopSelf();
  }
  if (!requestAudioFocus())   stopSelf();
  if (mediaPlayer == null) {
    mediaPlayer=new MediaPlayer();
    mediaPlayer.setOnCompletionListener(this);
    mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
    loadSentence();
    play();
  }
  if (mediaSessionManager == null) {
    initMediaSession();
  }
  handleIncomingActions(intent);
  return super.onStartCommand(intent,flags,startId);
}
Program: 79464
Project: 79464
Buggy source:
@Override public void onTick(long millisUntilFinished){
  millisLeft=millisUntilFinished;
  updateTime();
}

Fixed version (ground truth):
@Override public void onTick(long millisUntilFinished){
  if (!isPaused) {
    millisLeft=millisUntilFinished;
    updateTime();
  }
}
Program: 79465
Project: 79465
Buggy source:
private void nextSentence(SentencePair sentencePair){
  sentencesLayout.setVisibility(View.VISIBLE);
  Sentence baseSentence=sentencePair.getBaseSentence();
  Sentence targetSentence=sentencePair.getTargetSentence();
  remainingRepsText.setText(String.format(Locale.getDefault(),"String_Node_Str",course.getCurrentDay().getNumReviewsLeft()));
  millisLeft=course.getCurrentDay().getTimeLeft();
  if (countDownTimer != null)   countDownTimer.cancel();
  startTimer();
  updateTime();
  baseSentenceText.setText(baseSentence.getText());
  updateSentencePart(baseAlternateSentenceLayout,baseAlternateSentenceText,baseSentence.getAlternate());
  updateSentencePart(baseRomanizationLayout,baseRomanizationText,baseSentence.getRomanization());
  updateSentencePart(baseIpaLayout,baseIpaText,baseSentence.getIpa());
  targetSentenceText.setText(targetSentence.getText());
  updateSentencePart(targetAlternateSentenceLayout,targetAlternateSentenceText,targetSentence.getAlternate());
  updateSentencePart(targetRomanizationLayout,targetRomanizationText,targetSentence.getRomanization());
  updateSentencePart(targetIpaLayout,targetIpaText,targetSentence.getIpa());
}

Fixed version (ground truth):
private void nextSentence(SentencePair sentencePair){
  sentencesLayout.setVisibility(View.VISIBLE);
  Sentence baseSentence=sentencePair.getBaseSentence();
  Sentence targetSentence=sentencePair.getTargetSentence();
  remainingRepsText.setText(String.format(Locale.getDefault(),"String_Node_Str",course.getCurrentDay().getNumReviewsLeft()));
  millisLeft=course.getCurrentDay().getTimeLeft();
  baseSentenceText.setText(baseSentence.getText());
  updateSentencePart(baseAlternateSentenceLayout,baseAlternateSentenceText,baseSentence.getAlternate());
  updateSentencePart(baseRomanizationLayout,baseRomanizationText,baseSentence.getRomanization());
  updateSentencePart(baseIpaLayout,baseIpaText,baseSentence.getIpa());
  targetSentenceText.setText(targetSentence.getText());
  updateSentencePart(targetAlternateSentenceLayout,targetAlternateSentenceText,targetSentence.getAlternate());
  updateSentencePart(targetRomanizationLayout,targetRomanizationText,targetSentence.getRomanization());
  updateSentencePart(targetIpaLayout,targetIpaText,targetSentence.getIpa());
}
Program: 79466
Project: 79466
Buggy source:
@Override public void onFinish(){
}

Fixed version (ground truth):
@Override public void onFinish(){
  Log.d(TAG,"String_Node_Str" + this.toString());
}
Program: 79467
Project: 79467
Buggy source:
private void connectToService(){
  serviceDisposable=activity.getSessionPublish().subscribe(service -> {
    if (course.getCurrentDay().getCurrentSentencePair() != null)     nextSentence(course.getCurrentDay().getCurrentSentencePair());
    studySessionService=service;
    sentenceDisposable=studySessionService.sentenceObservable().subscribe(this::nextSentence);
    finishDisposable=studySessionService.finishObservable().subscribe(this::sessionFinished);
    updatePlayPauseImage();
  }
);
  activity.startSession(course.getCurrentDay());
}

Fixed version (ground truth):
private void connectToService(){
  serviceDisposable=activity.getSessionPublish().subscribe(service -> {
    if (course.getCurrentDay().getCurrentSentencePair() != null)     nextSentence(course.getCurrentDay().getCurrentSentencePair());
    studySessionService=service;
    sentenceDisposable=studySessionService.sentenceObservable().subscribe(this::nextSentence);
    finishDisposable=studySessionService.finishObservable().subscribe(this::sessionFinished);
    setPaused(studySessionService.getPlaybackStatus() == StudySessionService.PlaybackStatus.PAUSED);
    if (!isPaused) {
      startTimer();
    }
    updateTime();
    updatePlayPauseImage();
  }
);
  activity.startSession(course.getCurrentDay());
}
Program: 79468
Project: 79468
Buggy source:
private void startTimer(){
  millisLeft=millisLeft - millisLeft % 1000 - 1;
  updateTime();
  countDownTimer=new CountDownTimer(millisLeft,100){
    @Override public void onTick(    long millisUntilFinished){
      millisLeft=millisUntilFinished;
      updateTime();
    }
    @Override public void onFinish(){
    }
  }
.start();
}

Fixed version (ground truth):
private void startTimer(){
  millisLeft=millisLeft - millisLeft % 1000 - 1;
  updateTime();
  countDownTimer=new CountDownTimer(millisLeft,100){
    @Override public void onTick(    long millisUntilFinished){
      if (!isPaused) {
        millisLeft=millisUntilFinished;
        updateTime();
      }
    }
    @Override public void onFinish(){
      Log.d(TAG,"String_Node_Str" + this.toString());
    }
  }
;
  setPaused(false);
  countDownTimer.start();
}
Program: 79469
Project: 79469
Buggy source:
private void playPause(View view){
  if (studySessionService != null) {
    if (studySessionService.getPlaybackStatus() == StudySessionService.PlaybackStatus.PLAYING) {
      studySessionService.pause();
      countDownTimer.cancel();
    }
 else {
      studySessionService.resume();
      startTimer();
    }
    updatePlayPauseImage();
  }
}

Fixed version (ground truth):
private void playPause(View view){
  if (studySessionService != null) {
    if (studySessionService.getPlaybackStatus() == StudySessionService.PlaybackStatus.PLAYING) {
      studySessionService.pause();
      setPaused(true);
      if (countDownTimer != null)       countDownTimer.cancel();
    }
 else {
      studySessionService.resume();
      startTimer();
    }
    updatePlayPauseImage();
  }
}
Program: 79471
Project: 79471
Buggy source:
public void startSession(Day day){
  Utils.Storage storage=new Utils.Storage(this);
  storage.putDayId(day.getId());
  if (!isServiceBound) {
    Intent intent=new Intent(this,StudySessionService.class);
    startService(intent);
    bindService(intent,serviceConnection,Context.BIND_AUTO_CREATE);
  }
 else {
    Intent intent=new Intent(StudySessionService.BROADCAST_START_SESSION);
    sendBroadcast(intent);
  }
}

Fixed version (ground truth):
public void startSession(Day day){
  Utils.Storage storage=new Utils.Storage(this);
  storage.putDayId(day.getId());
  if (!isServiceBound) {
    Intent intent=new Intent(this,StudySessionService.class);
    startService(intent);
    bindService(intent,serviceConnection,Context.BIND_AUTO_CREATE);
  }
 else {
    Intent intent=new Intent(StudySessionService.BROADCAST_START_SESSION);
    sendBroadcast(intent);
    sessionPublish.onNext(studySessionService);
  }
}
Program: 79472
Project: 79472
Buggy source:
private void connectToService(){
  activity.startSession(course.getCurrentDay());
  serviceDisposable=activity.getSessionPublish().subscribe(service -> {
    nextSentence(course.getCurrentDay().getCurrentSentencePair());
    studySessionService=service;
    sentenceDisposable=studySessionService.sentenceObservable().subscribe(this::nextSentence);
    finishDisposable=studySessionService.finishObservable().subscribe(this::sessionFinished);
    updatePlayPauseImage();
  }
);
}

Fixed version (ground truth):
private void connectToService(){
  serviceDisposable=activity.getSessionPublish().subscribe(service -> {
    if (course.getCurrentDay().getCurrentSentencePair() != null)     nextSentence(course.getCurrentDay().getCurrentSentencePair());
    studySessionService=service;
    sentenceDisposable=studySessionService.sentenceObservable().subscribe(this::nextSentence);
    finishDisposable=studySessionService.finishObservable().subscribe(this::sessionFinished);
    updatePlayPauseImage();
  }
);
  activity.startSession(course.getCurrentDay());
}
Program: 79473
Project: 79473
Buggy source:
public Day prepareNextDay(Realm realm){
  if (currentDay != null && currentDay.isCompleted()) {
    realm.executeTransaction(r -> pastDays.add(currentDay));
  }
  realm.executeTransaction(r -> {
    Day day=r.createObject(Day.class,UUID.randomUUID().toString());
    for (    Schedule schedule : schedules) {
      RealmList<Integer> reviewPattern=schedule.getReviewPattern();
      int numSentences=schedule.getNumSentences();
      int sentenceIndex=schedule.getSentenceIndex();
      schedule.setSentenceIndex(sentenceIndex + numSentences);
      SentenceSet sentenceSet=new SentenceSet();
      sentenceSet.setBaseSentences(getSentences(sentenceIndex,numSentences,basePacks));
      sentenceSet.setTargetSentences(getSentences(sentenceIndex,numSentences,targetPacks));
      sentenceSet.setReviews(reviewPattern);
      sentenceSet.setFirstDay(true);
      sentenceSet.setOrder(schedule.getOrder());
      day.getSentenceSets().add(sentenceSet);
    }
    day.setCompleted(false);
    day.setPauseMillis(pauseMillis);
    if (currentDay != null)     day.getSentenceSets().addAll(currentDay.getSentenceSets());
    currentDay=day;
  }
);
  List<SentenceSet> emptySentenceSets=new ArrayList<>();
  for (  SentenceSet set : currentDay.getSentenceSets()) {
    if (!set.buildSentences(realm)) {
      emptySentenceSets.add(set);
    }
  }
  realm.executeTransaction(r -> currentDay.getSentenceSets().removeAll(emptySentenceSets));
  return currentDay;
}

Fixed version (ground truth):
public void prepareNextDay(Realm realm){
  if (currentDay != null && currentDay.isCompleted()) {
    realm.executeTransaction(r -> pastDays.add(currentDay));
  }
  realm.executeTransaction(r -> {
    Day day=r.createObject(Day.class,UUID.randomUUID().toString());
    for (    Schedule schedule : schedules) {
      RealmList<Integer> reviewPattern=schedule.getReviewPattern();
      int numSentences=schedule.getNumSentences();
      int sentenceIndex=schedule.getSentenceIndex();
      schedule.setSentenceIndex(sentenceIndex + numSentences);
      SentenceSet sentenceSet=new SentenceSet();
      sentenceSet.setBaseSentences(getSentences(sentenceIndex,numSentences,basePacks));
      sentenceSet.setTargetSentences(getSentences(sentenceIndex,numSentences,targetPacks));
      sentenceSet.setReviews(reviewPattern);
      sentenceSet.setFirstDay(true);
      sentenceSet.setOrder(schedule.getOrder());
      day.getSentenceSets().add(sentenceSet);
    }
    day.setCompleted(false);
    day.setPauseMillis(pauseMillis);
    if (currentDay != null)     day.getSentenceSets().addAll(currentDay.getSentenceSets());
    currentDay=day;
  }
);
  List<SentenceSet> emptySentenceSets=new ArrayList<>();
  for (  SentenceSet set : currentDay.getSentenceSets()) {
    if (!set.buildSentences(realm)) {
      emptySentenceSets.add(set);
    }
  }
  realm.executeTransaction(r -> currentDay.getSentenceSets().removeAll(emptySentenceSets));
}
Program: 79474
Project: 79474
Buggy source:
@Override public int onStartCommand(Intent intent,int flags,int startId){
  if (intent.getExtras() == null)   stopSelf();
  realm=Realm.getDefaultInstance();
  String id=new Utils.Storage(getApplicationContext()).getDayId();
  if (day == null) {
    day=realm.where(Day.class).equalTo("String_Node_Str",id).findFirst();
    if (day == null)     stopSelf();
    day.resetReviews(realm);
  }
  if (!requestAudioFocus())   stopSelf();
  if (mediaPlayer == null) {
    mediaPlayer=new MediaPlayer();
    mediaPlayer.setOnCompletionListener(this);
    mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
    loadSentence();
  }
  if (mediaSessionManager == null) {
    initMediaSession();
  }
  handleIncomingActions(intent);
  return super.onStartCommand(intent,flags,startId);
}

Fixed version (ground truth):
@Override public int onStartCommand(Intent intent,int flags,int startId){
  if (intent.getExtras() == null)   stopSelf();
  realm=Realm.getDefaultInstance();
  String id=new Utils.Storage(getApplicationContext()).getDayId();
  if (day == null) {
    day=realm.where(Day.class).equalTo("String_Node_Str",id).findFirst();
    if (day == null)     stopSelf();
  }
  if (!requestAudioFocus())   stopSelf();
  if (mediaPlayer == null) {
    mediaPlayer=new MediaPlayer();
    mediaPlayer.setOnCompletionListener(this);
    mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
    loadSentence();
  }
  if (mediaSessionManager == null) {
    initMediaSession();
  }
  handleIncomingActions(intent);
  return super.onStartCommand(intent,flags,startId);
}
Program: 79475
Project: 79475
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  String id=new Utils.Storage(getApplicationContext()).getDayId();
  day=realm.where(Day.class).equalTo("String_Node_Str",id).findFirst();
  if (day == null)   stopSelf();
  day.resetReviews(realm);
  stop();
  mediaPlayer.reset();
  if (!requestAudioFocus())   stopSelf();
  loadSentence();
  play();
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  String id=new Utils.Storage(getApplicationContext()).getDayId();
  day=realm.where(Day.class).equalTo("String_Node_Str",id).findFirst();
  if (day == null)   stopSelf();
  stop();
  mediaPlayer.reset();
  if (!requestAudioFocus())   stopSelf();
  loadSentence();
  play();
}
Program: 79476
Project: 79476
Buggy source:
private void extractAudio(){
  actionText.getResources().getString(R.string.extracting_sentence_audio);
}

Fixed version (ground truth):
private void extractAudio(){
  actionText.setText(getResources().getString(R.string.extracting_sentence_audio));
}
Program: 79477
Project: 79477
Buggy source:
private void readSentences(){
  actionText.getResources().getString(R.string.reading_sentences);
  counterText.setVisibility(View.GONE);
  dividerBarLabel.setVisibility(View.GONE);
  totalText.setVisibility(View.GONE);
}

Fixed version (ground truth):
private void readSentences(){
  actionText.setText(getResources().getString(R.string.reading_sentences));
  counterText.setVisibility(View.GONE);
  dividerBarLabel.setVisibility(View.GONE);
  totalText.setVisibility(View.GONE);
}
Program: 79478
Project: 79478
Buggy source:
@SuppressLint("String_Node_Str") @Override public void onViewCreated(@NonNull View view,@Nullable Bundle savedInstanceState){
  Uri uri=getArguments().getParcelable(EXTRA_URI);
  GLSImporter importer=new GLSImporter();
  importer.totalObservable().subscribe(total -> {
    if (getActivity() != null)     getActivity().runOnUiThread(() -> {
      totalText.setText(String.valueOf(total));
      progressBar.setMax(total);
    }
);
  }
);
  importer.progressObservable().subscribe(progress -> {
    if (getActivity() != null)     getActivity().runOnUiThread(() -> {
      counterText.setText(String.valueOf(progress));
      progressBar.setProgress(progress);
      if (curAction == ACTION_EXTRACTING_AUDIO && progressBar.getMax() == progress) {
        loadLanguageListFragment();
      }
    }
);
  }
);
  importer.fileNameSubject().subscribe(filename -> {
    fileNameText.setVisibility(View.VISIBLE);
    fileNameText.setText(filename);
  }
);
  importer.actionSubject().subscribe(actionId -> {
    if (getActivity() != null)     getActivity().runOnUiThread(() -> {
      curAction=actionId;
switch (actionId) {
case ACTION_OPENING_FILE:
        openFile();
      break;
case ACTION_COUNTING_SENTENCES:
    countSentences();
  break;
case ACTION_READING_SENTENCES:
readSentences();
break;
case ACTION_EXTRACTING_TEXT:
extractText();
break;
case ACTION_EXTRACTING_AUDIO:
extractAudio();
break;
case ACTION_EXIT:
loadLanguageListFragment();
break;
}
}
);
}
);
importer.importPack(getContext(),uri);
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") @Override public void onViewCreated(@NonNull View view,@Nullable Bundle savedInstanceState){
  Uri uri=getArguments().getParcelable(EXTRA_URI);
  GLSImporter importer=new GLSImporter();
  importer.totalObservable().subscribe(total -> {
    if (getActivity() != null)     getActivity().runOnUiThread(() -> {
      totalText.setText(String.valueOf(total));
      progressBar.setMax(total);
    }
);
  }
);
  importer.progressObservable().subscribe(progress -> {
    if (getActivity() != null)     getActivity().runOnUiThread(() -> {
      counterText.setText(String.valueOf(progress));
      progressBar.setProgress(progress);
      if (curAction == ACTION_EXTRACTING_AUDIO && progressBar.getMax() == progress) {
        loadLanguageListFragment();
      }
    }
);
  }
);
  importer.fileNameSubject().subscribe(filename -> {
    if (getActivity() != null)     getActivity().runOnUiThread(() -> {
      fileNameText.setVisibility(View.VISIBLE);
      fileNameText.setText(filename);
    }
);
  }
);
  importer.actionSubject().subscribe(actionId -> {
    if (getActivity() != null)     getActivity().runOnUiThread(() -> {
      curAction=actionId;
switch (actionId) {
case ACTION_OPENING_FILE:
        openFile();
      break;
case ACTION_COUNTING_SENTENCES:
    countSentences();
  break;
case ACTION_READING_SENTENCES:
readSentences();
break;
case ACTION_EXTRACTING_TEXT:
extractText();
break;
case ACTION_EXTRACTING_AUDIO:
extractAudio();
break;
case ACTION_EXIT:
loadLanguageListFragment();
break;
}
}
);
}
);
importer.importPack(getContext(),uri);
}
Program: 79479
Project: 79479
Buggy source:
public void createSentenceOrUpdate(Realm r,int index,String sentence,String ipa,String romanization,String uri){
  Sentence newSentence=getSentenceWithIndex(index);
  if (newSentence == null) {
    newSentence=r.createObject(Sentence.class,UUID.randomUUID().toString());
    sentences.add(newSentence);
  }
  newSentence.setIndex(index);
  if (sentence != null)   newSentence.setText(sentence);
  if (ipa != null)   newSentence.setIpa(ipa);
  if (romanization != null)   newSentence.setRomanization(romanization);
  if (uri != null)   newSentence.setUri(uri);
}

Fixed version (ground truth):
public void createSentenceOrUpdate(Realm realm,int index,String sentence,String ipa,String romanization,String uri){
  realm.executeTransaction(r -> {
    Sentence newSentence=getSentenceWithIndex(index);
    if (newSentence == null) {
      newSentence=r.createObject(Sentence.class,UUID.randomUUID().toString());
      sentences.add(newSentence);
    }
    newSentence.setIndex(index);
    if (sentence != null)     newSentence.setText(sentence);
    if (ipa != null)     newSentence.setIpa(ipa);
    if (romanization != null)     newSentence.setRomanization(romanization);
    if (uri != null)     newSentence.setUri(uri);
  }
);
}
Program: 79481
Project: 79481
Buggy source:
/** 
 * 判断当前页数是否小于等于最大页数
 * @param document
 * @param currentPage
 * @return
 */
private boolean hasPage(Document document,int currentPage){
  if (mTypeMaxPageMap == null) {
    mTypeMaxPageMap=new HashMap<>();
  }
  if (mTypeMaxPageMap.get(mCurrentUrl) != null) {
    return currentPage <= mTypeMaxPageMap.get(mCurrentUrl);
  }
  Elements elements=document.select("String_Node_Str");
  int maxPage=-1;
  for (  Element element : elements) {
    if (element.hasClass("String_Node_Str")) {
      continue;
    }
    String text=element.text();
    try {
      int page=Integer.parseInt(text);
      if (page > maxPage) {
        maxPage=page;
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  mTypeMaxPageMap.put(mCurrentUrl,maxPage);
  return currentPage <= maxPage;
}

Fixed version (ground truth):
/** 
 * 判断当前页数是否小于等于最大页数
 * @param document
 * @param currentPage
 * @return
 */
private boolean hasPage(Document document,int currentPage){
  if (mTypeMaxPageMap == null) {
    mTypeMaxPageMap=new HashMap<>();
  }
  if (mTypeMaxPageMap.get(mCurrentUrl) != null) {
    return currentPage <= mTypeMaxPageMap.get(mCurrentUrl);
  }
  Elements elements=document.select("String_Node_Str");
  int maxPage=-1;
  for (  Element element : elements) {
    if (element.hasClass("String_Node_Str")) {
      continue;
    }
    String text=element.text();
    if (text.matches("String_Node_Str")) {
      continue;
    }
    try {
      int page=Integer.parseInt(text);
      if (page > maxPage) {
        maxPage=page;
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  mTypeMaxPageMap.put(mCurrentUrl,maxPage);
  return currentPage <= maxPage;
}
Program: 79486
Project: 79486
Buggy source:
@Override public Node visitStringConst(EMxStarParser.StringConstContext ctx){
  return new StringConstExprNode(ctx.getText().substring(1,ctx.getText().length() - 1),Location.fromCtx(ctx));
}

Fixed version (ground truth):
@Override public Node visitStringConst(EMxStarParser.StringConstContext ctx){
  String str=ctx.getText();
  return new StringConstExprNode(unescape(str.substring(1,str.length() - 1)),Location.fromCtx(ctx));
}
Program: 79489
Project: 79489
Buggy source:
private void processIRAssign(RegValue dest,int addrOffset,ExprNode rhs,int size,boolean needMemOp){
  if (rhs.getType() instanceof BoolType) {
    BasicBlock mergeBB=new BasicBlock(currentFunc,null);
    if (needMemOp) {
      rhs.getTrueBB().addInst(new IRStore(rhs.getTrueBB(),new IntImmediate(1),BoolType.getInstance().getVarSize(),dest,addrOffset));
      rhs.getFalseBB().addInst(new IRStore(rhs.getFalseBB(),new IntImmediate(0),BoolType.getInstance().getVarSize(),dest,addrOffset));
    }
 else {
      rhs.getTrueBB().addInst(new IRMove(rhs.getTrueBB(),(VirtualRegister)dest,new IntImmediate(1)));
      rhs.getFalseBB().addInst(new IRMove(rhs.getFalseBB(),(VirtualRegister)dest,new IntImmediate(0)));
    }
    rhs.getTrueBB().setJumpInst(new IRJump(rhs.getTrueBB(),mergeBB));
    rhs.getFalseBB().setJumpInst(new IRJump(rhs.getFalseBB(),mergeBB));
    currentBB=mergeBB;
  }
 else {
    if (needMemOp) {
      currentBB.addInst(new IRStore(currentBB,rhs.getRegValue(),rhs.getType().getVarSize(),dest,addrOffset));
    }
 else {
      currentBB.addInst(new IRMove(currentBB,(IRRegister)dest,rhs.getRegValue()));
    }
  }
}

Fixed version (ground truth):
private void processIRAssign(RegValue dest,int addrOffset,ExprNode rhs,int size,boolean needMemOp){
  if (rhs.getTrueBB() != null) {
    BasicBlock mergeBB=new BasicBlock(currentFunc,null);
    if (needMemOp) {
      rhs.getTrueBB().addInst(new IRStore(rhs.getTrueBB(),new IntImmediate(1),BoolType.getInstance().getVarSize(),dest,addrOffset));
      rhs.getFalseBB().addInst(new IRStore(rhs.getFalseBB(),new IntImmediate(0),BoolType.getInstance().getVarSize(),dest,addrOffset));
    }
 else {
      rhs.getTrueBB().addInst(new IRMove(rhs.getTrueBB(),(VirtualRegister)dest,new IntImmediate(1)));
      rhs.getFalseBB().addInst(new IRMove(rhs.getFalseBB(),(VirtualRegister)dest,new IntImmediate(0)));
    }
    if (!rhs.getTrueBB().isHasJumpInst())     rhs.getTrueBB().setJumpInst(new IRJump(rhs.getTrueBB(),mergeBB));
    if (!rhs.getFalseBB().isHasJumpInst())     rhs.getFalseBB().setJumpInst(new IRJump(rhs.getFalseBB(),mergeBB));
    currentBB=mergeBB;
  }
 else {
    if (needMemOp) {
      currentBB.addInst(new IRStore(currentBB,rhs.getRegValue(),rhs.getType().getVarSize(),dest,addrOffset));
    }
 else {
      currentBB.addInst(new IRMove(currentBB,(IRRegister)dest,rhs.getRegValue()));
    }
  }
}