Program: 79927
Project: 79927
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_resume);
  idSessione=getIntent().getLongExtra(ExtrasDefinition.ID_TOKEN,EXTRA_DEFAULT_VALUE);
  if (idSessione == EXTRA_DEFAULT_VALUE) {
    SessionValidator.finishSession(this,idSessione);
  }
  startSession=getIntent().getStringExtra(ExtrasDefinition.START_SESSION);
  if (startSession == null) {
    SessionValidator.finishSession(this,idSessione);
  }
 else   if (SessionValidator.isExpired(startSession)) {
    SessioneQueries.endSession(idSessione);
    SessionValidator.finishSession(this,idSessione);
  }
  final int idProgrammazione=getIntent().getIntExtra(ExtrasDefinition.ID_PROGRAMMAZIONE,EXTRA_DEFAULT_VALUE);
  if (idProgrammazione == EXTRA_DEFAULT_VALUE) {
    SessionValidator.finishSession(this,idSessione);
  }
  idUtente=getIntent().getIntExtra(ExtrasDefinition.ID_UTENTE,EXTRA_DEFAULT_VALUE);
  if (idUtente == EXTRA_DEFAULT_VALUE) {
    SessionValidator.finishSession(this,idSessione);
  }
  posti=getIntent().getIntegerArrayListExtra(ExtrasDefinition.POSTI_PRENOTARE);
  if (posti == null || posti.isEmpty()) {
    SessionValidator.finishSession(this,idSessione);
  }
  TextView tvTitolo=findViewById(R.id.tvTitolo);
  TextView tvData=findViewById(R.id.tvData);
  TextView tvOra=findViewById(R.id.tvOrarioLabel);
  TextView tvSala=findViewById(R.id.tvSala);
  TextView tvIdSessione=findViewById(R.id.tvId);
  TextView tvPostiPrenotati=findViewById(R.id.tvPosti);
  tvIdSessione.setText("String_Node_Str" + idSessione);
  ConstraintLayout resumeContainer=findViewById(R.id.resumeContainer);
  prenotatoContainer=findViewById(R.id.doneReveal);
  Programmazione pr=ProgrammazioneQueries.getProgrammmazione(idProgrammazione);
  if (pr == null) {
    SessionValidator.finishSession(this,idSessione);
  }
  Film film=FilmQueries.getFilm(pr.getIdFilm());
  Sala s=SalaQueries.getSala(pr.getIdSala());
  tvSala.setText(s.getNome());
  if (film != null) {
    tvTitolo.setText(film.getTitolo());
    try {
      tvData.setText(DateParser.getFormattedDate(pr.getData()));
    }
 catch (    ParseException e) {
      tvData.setText(pr.getData());
    }
    tvOra.setText(pr.getOra());
  }
  String charDelimit="String_Node_Str";
  StringBuilder postiString=new StringBuilder();
  for (int i=0; i < posti.size(); i++) {
    postiString.append(posti.get(i));
    if (i != posti.size() - 1) {
      postiString.append(charDelimit);
    }
  }
  tvPostiPrenotati.setText(postiString.toString());
  Snackbar.make(findViewById(R.id.resume_container_1),R.string.hintPrenotazione,Snackbar.LENGTH_LONG).show();
  ImageView qrCode=findViewById(R.id.qrCode);
  qrCode.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      View dialog=getLayoutInflater().inflate(R.layout.dialog_show_qr_barcode,null);
      ((ImageView)dialog).setImageDrawable(ContextCompat.getDrawable(getApplicationContext(),R.drawable.qr_code));
      new AlertDialog.Builder(ResumeActivity.this).setView(dialog).show();
    }
  }
);
  ImageView barcode=findViewById(R.id.barcode);
  barcode.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      View dialog=getLayoutInflater().inflate(R.layout.dialog_show_qr_barcode,null);
      ((ImageView)dialog).setImageDrawable(ContextCompat.getDrawable(getApplicationContext(),R.drawable.barcode));
      new AlertDialog.Builder(ResumeActivity.this).setView(dialog).show();
    }
  }
);
  resumeContainer.setOnLongClickListener(new View.OnLongClickListener(){
    @Override public boolean onLongClick(    View v){
      if (!isBigliettoComprato) {
        daAcquistare=true;
        Vibrator vibe=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
        if (vibe != null) {
          vibe.vibrate(VIBRATION_DURATE);
        }
        doRevealAnimation();
        new Handler().postDelayed(new Runnable(){
          @Override public void run(){
            Snackbar snack=Snackbar.make(findViewById(R.id.resume_container_1),R.string.snackConfermaPrenotazione,Snackbar.LENGTH_LONG);
            snack.setAction(android.R.string.cancel,new View.OnClickListener(){
              @Override public void onClick(              View v){
                daAcquistare=false;
              }
            }
);
            snack.setDuration(SNACKBAR_CONFERMA_DURATION);
            snack.show();
            new Handler().postDelayed(new Runnable(){
              @Override public void run(){
                if (daAcquistare) {
                  long idPrenotazione=PrenotazioneQueries.addPrenotazione(new Prenotazione(0,idProgrammazione,idUtente));
                  for (                  Integer index : posti) {
                    PostoPrenotato p=new PostoPrenotato(0,(int)idPrenotazione,index);
                    PostoPrenotatoQueries.addPostoPrenotato(p);
                    isBigliettoComprato=!isBigliettoComprato;
                  }
                }
 else {
                  Snackbar.make(findViewById(R.id.resume_container_1),R.string.snackAnnullataPrenotazione,Snackbar.LENGTH_LONG).show();
                }
              }
            }
,SNACKBAR_CONFERMA_DURATION);
          }
        }
,ANIMATION_DURATION + SECOND_ANIM_DURATION);
      }
      return true;
    }
  }
);
  resumeContainer.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (isBigliettoComprato) {
        Snackbar.make(findViewById(R.id.resume_container_1),R.string.hintPrenotazioneEffettuata,Snackbar.LENGTH_LONG).show();
      }
 else {
        Snackbar.make(findViewById(R.id.resume_container_1),R.string.hintPrenotazione,Snackbar.LENGTH_LONG).show();
      }
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_resume);
  idSessione=getIntent().getLongExtra(ExtrasDefinition.ID_TOKEN,EXTRA_DEFAULT_VALUE);
  if (idSessione == EXTRA_DEFAULT_VALUE) {
    SessionValidator.finishSession(this,idSessione);
  }
  startSession=getIntent().getStringExtra(ExtrasDefinition.START_SESSION);
  if (startSession == null) {
    SessionValidator.finishSession(this,idSessione);
  }
 else   if (SessionValidator.isExpired(startSession)) {
    SessioneQueries.endSession(idSessione);
    SessionValidator.finishSession(this,idSessione);
  }
  final int idProgrammazione=getIntent().getIntExtra(ExtrasDefinition.ID_PROGRAMMAZIONE,EXTRA_DEFAULT_VALUE);
  if (idProgrammazione == EXTRA_DEFAULT_VALUE) {
    SessionValidator.finishSession(this,idSessione);
  }
  idUtente=getIntent().getIntExtra(ExtrasDefinition.ID_UTENTE,EXTRA_DEFAULT_VALUE);
  if (idUtente == EXTRA_DEFAULT_VALUE) {
    SessionValidator.finishSession(this,idSessione);
  }
  posti=getIntent().getIntegerArrayListExtra(ExtrasDefinition.POSTI_PRENOTARE);
  if (posti == null || posti.isEmpty()) {
    SessionValidator.finishSession(this,idSessione);
  }
  TextView tvTitolo=findViewById(R.id.tvTitolo);
  TextView tvData=findViewById(R.id.tvData);
  TextView tvOra=findViewById(R.id.tvOrarioLabel);
  TextView tvSala=findViewById(R.id.tvSala);
  TextView tvIdSessione=findViewById(R.id.tvId);
  TextView tvPostiPrenotati=findViewById(R.id.tvPosti);
  tvIdSessione.setText("String_Node_Str" + idSessione);
  ConstraintLayout resumeContainer=findViewById(R.id.resumeContainer);
  prenotatoContainer=findViewById(R.id.doneReveal);
  Programmazione pr=ProgrammazioneQueries.getProgrammmazione(idProgrammazione);
  if (pr == null) {
    SessionValidator.finishSession(this,idSessione);
  }
  Film film=FilmQueries.getFilm(pr.getIdFilm());
  Sala s=SalaQueries.getSala(pr.getIdSala());
  tvSala.setText(s.getNome());
  if (film != null) {
    tvTitolo.setText(film.getTitolo());
    try {
      tvData.setText(DateParser.getFormattedDate(pr.getData()));
    }
 catch (    ParseException e) {
      tvData.setText(pr.getData());
    }
    tvOra.setText(pr.getOra());
  }
  String charDelimit="String_Node_Str";
  StringBuilder postiString=new StringBuilder();
  for (int i=0; i < posti.size(); i++) {
    postiString.append(posti.get(i));
    if (i != posti.size() - 1) {
      postiString.append(charDelimit);
    }
  }
  tvPostiPrenotati.setText(postiString.toString());
  Snackbar.make(findViewById(R.id.resume_container_1),R.string.hintPrenotazione,Snackbar.LENGTH_LONG).show();
  ImageView qrCode=findViewById(R.id.qrCode);
  qrCode.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      View dialog=getLayoutInflater().inflate(R.layout.dialog_show_qr_barcode,null);
      ((ImageView)dialog).setImageDrawable(ContextCompat.getDrawable(getApplicationContext(),R.drawable.qr_code));
      new AlertDialog.Builder(ResumeActivity.this).setView(dialog).show();
    }
  }
);
  ImageView barcode=findViewById(R.id.barcode);
  barcode.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      View dialog=getLayoutInflater().inflate(R.layout.dialog_show_qr_barcode,null);
      ((ImageView)dialog).setImageDrawable(ContextCompat.getDrawable(getApplicationContext(),R.drawable.barcode));
      new AlertDialog.Builder(ResumeActivity.this).setView(dialog).show();
    }
  }
);
  resumeContainer.setOnLongClickListener(new View.OnLongClickListener(){
    @Override public boolean onLongClick(    View v){
      if (!isBigliettoComprato) {
        daAcquistare=true;
        Vibrator vibe=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
        if (vibe != null) {
          vibe.vibrate(VIBRATION_DURATE);
        }
        doRevealAnimation();
        new Handler().postDelayed(new Runnable(){
          @Override public void run(){
            Snackbar snack=Snackbar.make(findViewById(R.id.resume_container_1),R.string.snackConfermaPrenotazione,Snackbar.LENGTH_LONG);
            snack.setAction(android.R.string.cancel,new View.OnClickListener(){
              @Override public void onClick(              View v){
                daAcquistare=false;
              }
            }
);
            snack.setDuration(SNACKBAR_CONFERMA_DURATION);
            snack.show();
            new Handler().postDelayed(new Runnable(){
              @Override public void run(){
                if (daAcquistare) {
                  long idPrenotazione=PrenotazioneQueries.addPrenotazione(new Prenotazione(0,idProgrammazione,idUtente));
                  for (                  Integer index : posti) {
                    PostoPrenotato p=new PostoPrenotato(0,(int)idPrenotazione,index);
                    PostoPrenotatoQueries.addPostoPrenotato(p);
                  }
                  isBigliettoComprato=!isBigliettoComprato;
                }
 else {
                  Snackbar.make(findViewById(R.id.resume_container_1),R.string.snackAnnullataPrenotazione,Snackbar.LENGTH_LONG).show();
                }
              }
            }
,SNACKBAR_CONFERMA_DURATION);
          }
        }
,ANIMATION_DURATION + SECOND_ANIM_DURATION);
      }
      return true;
    }
  }
);
  resumeContainer.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (isBigliettoComprato) {
        Snackbar.make(findViewById(R.id.resume_container_1),R.string.hintPrenotazioneEffettuata,Snackbar.LENGTH_LONG).show();
      }
 else {
        Snackbar.make(findViewById(R.id.resume_container_1),R.string.hintPrenotazione,Snackbar.LENGTH_LONG).show();
      }
    }
  }
);
}