Program: 142178
Project: 142178
Buggy source:
public void setAVT(TextView text,String audioURI,String imageURI,final String videoURI,final String bigImageURI,final String qrCodeContent){
  mView_Text=text;
  RelativeLayout.LayoutParams textParams=new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  RelativeLayout.LayoutParams audioParams=new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  RelativeLayout.LayoutParams imageParams=new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);
  imageParams.addRule(CENTER_IN_PARENT);
  RelativeLayout.LayoutParams videoParams=new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  RelativeLayout.LayoutParams topPaneParams=new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  RelativeLayout topPane=new RelativeLayout(this.getContext());
  topPane.setId(2342134);
  this.addView(topPane,topPaneParams);
  if (audioURI != null) {
    mAudioButton=new AudioButton(getContext(),audioURI,true);
    mAudioButton.setId(3245345);
  }
  if (videoURI != null) {
    mVideoButton=new ImageButton(getContext());
    mVideoButton.setImageResource(android.R.drawable.ic_media_play);
    mVideoButton.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        String videoFilename="String_Node_Str";
        try {
          videoFilename=ReferenceManager._().DeriveReference(videoURI).getLocalURI();
        }
 catch (        InvalidReferenceException e) {
          Log.e(t,"String_Node_Str");
          e.printStackTrace();
        }
        File videoFile=new File(videoFilename);
        if (!videoFile.exists()) {
          String errorMsg=getContext().getString(R.string.file_missing,videoFilename);
          Log.e(t,errorMsg);
          Toast.makeText(getContext(),errorMsg,Toast.LENGTH_LONG).show();
          return;
        }
        Intent i=new Intent("String_Node_Str");
        i.setDataAndType(Uri.fromFile(videoFile),"String_Node_Str");
        try {
          String uri=Uri.fromFile(videoFile).getPath().replaceAll("String_Node_Str","String_Node_Str");
          Logger.log("String_Node_Str","String_Node_Str" + uri);
          getContext().startActivity(i);
        }
 catch (        ActivityNotFoundException e) {
          Toast.makeText(getContext(),getContext().getString(R.string.activity_not_found,"String_Node_Str"),Toast.LENGTH_SHORT).show();
        }
      }
    }
);
    mVideoButton.setId(234982340);
  }
  if (mAudioButton != null && mVideoButton == null) {
    audioParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    textParams.addRule(RelativeLayout.LEFT_OF,mAudioButton.getId());
    topPane.addView(mAudioButton,audioParams);
  }
 else   if (mAudioButton == null && mVideoButton != null) {
    videoParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    textParams.addRule(RelativeLayout.LEFT_OF,mVideoButton.getId());
    topPane.addView(mVideoButton,videoParams);
  }
 else   if (mAudioButton != null && mVideoButton != null) {
    audioParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    textParams.addRule(RelativeLayout.LEFT_OF,mAudioButton.getId());
    videoParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    videoParams.addRule(RelativeLayout.BELOW,mAudioButton.getId());
    topPane.addView(mAudioButton,audioParams);
    topPane.addView(mVideoButton,videoParams);
  }
 else {
    textParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
  }
  boolean textVisible=(mView_Text.getVisibility() != GONE);
  if (textVisible) {
    textParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    topPane.addView(mView_Text,textParams);
  }
  String errorMsg=null;
  View imageView=null;
  if (qrCodeContent != null) {
    Bitmap image;
    Display display=((WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
    int screenWidth=display.getWidth();
    int screenHeight=display.getHeight();
    int minimumDim=Math.min(screenWidth,screenHeight);
    try {
      QRCodeEncoder qrCodeEncoder=new QRCodeEncoder(qrCodeContent,minimumDim);
      image=qrCodeEncoder.encodeAsBitmap();
      mImageView=new ResizingImageView(getContext());
      mImageView.setPadding(10,10,10,10);
      mImageView.setAdjustViewBounds(true);
      mImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
      mImageView.setImageBitmap(image);
      mImageView.setId(23423534);
      imageView=mImageView;
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
 else   if (imageURI != null) {
    try {
      DisplayMetrics metrics=this.getContext().getResources().getDisplayMetrics();
      int maxWidth=metrics.widthPixels;
      int maxHeight=metrics.heightPixels;
      if (mView_Text != null) {
        maxHeight=maxHeight - mView_Text.getHeight();
      }
      if (mVideoButton != null) {
        maxHeight=maxHeight - mVideoButton.getHeight();
      }
 else       if (mAudioButton != null) {
        maxHeight=maxHeight - mAudioButton.getHeight();
      }
      maxHeight=(2 * maxHeight) / 3;
      final String imageFilename=ReferenceManager._().DeriveReference(imageURI).getLocalURI();
      final File imageFile=new File(imageFilename);
      if (imageFile.exists()) {
        Bitmap b=null;
        try {
          Display display=((WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
          int screenWidth=display.getWidth();
          int screenHeight=display.getHeight();
          b=FileUtils.getBitmapScaledToDisplay(imageFile,screenHeight,screenWidth);
        }
 catch (        OutOfMemoryError e) {
          errorMsg="String_Node_Str" + e.getMessage();
        }
        if (b != null) {
          mImageView=new ResizingImageView(getContext(),imageURI,bigImageURI);
          mImageView.setPadding(10,10,10,10);
          mImageView.setAdjustViewBounds(true);
          if (ResizingImageView.resizeMethod.equals("String_Node_Str") || ResizingImageView.resizeMethod.equals("String_Node_Str")) {
            mImageView.setMaxHeight(maxHeight);
            mImageView.setMaxWidth(maxWidth);
          }
          mImageView.setImageBitmap(b);
          mImageView.setId(23423534);
          imageView=mImageView;
        }
 else         if (errorMsg == null) {
          errorMsg=getContext().getString(R.string.file_invalid,imageFile);
        }
      }
 else {
        errorMsg=getContext().getString(R.string.file_missing,imageFile);
      }
      if (errorMsg != null) {
        Log.e(t,errorMsg);
        mMissingImage=new TextView(getContext());
        mMissingImage.setText(errorMsg);
        mMissingImage.setPadding(10,10,10,10);
        mMissingImage.setId(234873453);
        imageView=mMissingImage;
      }
    }
 catch (    InvalidReferenceException e) {
      Log.e(t,"String_Node_Str");
      e.printStackTrace();
    }
  }
  if (imageView != null) {
    RelativeLayout parent=this;
    imageParams.addRule(RelativeLayout.BELOW,topPane.getId());
    if (mAudioButton != null) {
      if (!textVisible) {
        imageParams.addRule(RelativeLayout.LEFT_OF,mAudioButton.getId());
        parent=topPane;
      }
    }
    if (mVideoButton != null) {
      if (!textVisible) {
        imageParams.addRule(RelativeLayout.LEFT_OF,mVideoButton.getId());
        parent=topPane;
      }
    }
    parent.addView(imageView,imageParams);
  }
}

Fixed version (ground truth):
public void setAVT(TextView text,String audioURI,String imageURI,final String videoURI,final String bigImageURI,final String qrCodeContent){
  mView_Text=text;
  RelativeLayout.LayoutParams textParams=new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  RelativeLayout.LayoutParams audioParams=new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  RelativeLayout.LayoutParams imageParams=new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);
  imageParams.addRule(CENTER_IN_PARENT);
  RelativeLayout.LayoutParams videoParams=new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  RelativeLayout.LayoutParams topPaneParams=new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  RelativeLayout topPane=new RelativeLayout(this.getContext());
  topPane.setId(2342134);
  this.addView(topPane,topPaneParams);
  if (audioURI != null) {
    mAudioButton=new AudioButton(getContext(),audioURI,true);
    mAudioButton.setId(3245345);
  }
  if (videoURI != null) {
    mVideoButton=new ImageButton(getContext());
    mVideoButton.setImageResource(android.R.drawable.ic_media_play);
    mVideoButton.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        String videoFilename="String_Node_Str";
        try {
          videoFilename=ReferenceManager._().DeriveReference(videoURI).getLocalURI();
        }
 catch (        InvalidReferenceException e) {
          Log.e(t,"String_Node_Str");
          e.printStackTrace();
        }
        File videoFile=new File(videoFilename);
        if (!videoFile.exists()) {
          String errorMsg=getContext().getString(R.string.file_missing,videoFilename);
          Log.e(t,errorMsg);
          Toast.makeText(getContext(),errorMsg,Toast.LENGTH_LONG).show();
          return;
        }
        Intent i=new Intent("String_Node_Str");
        i.setDataAndType(Uri.fromFile(videoFile),"String_Node_Str");
        try {
          String uri=Uri.fromFile(videoFile).getPath().replaceAll("String_Node_Str","String_Node_Str");
          Logger.log("String_Node_Str","String_Node_Str" + uri);
          getContext().startActivity(i);
        }
 catch (        ActivityNotFoundException e) {
          Toast.makeText(getContext(),getContext().getString(R.string.activity_not_found,"String_Node_Str"),Toast.LENGTH_SHORT).show();
        }
      }
    }
);
    mVideoButton.setId(234982340);
  }
  if (mAudioButton != null && mVideoButton == null) {
    audioParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    textParams.addRule(RelativeLayout.LEFT_OF,mAudioButton.getId());
    topPane.addView(mAudioButton,audioParams);
  }
 else   if (mAudioButton == null && mVideoButton != null) {
    videoParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    textParams.addRule(RelativeLayout.LEFT_OF,mVideoButton.getId());
    topPane.addView(mVideoButton,videoParams);
  }
 else   if (mAudioButton != null && mVideoButton != null) {
    audioParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    textParams.addRule(RelativeLayout.LEFT_OF,mAudioButton.getId());
    videoParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    videoParams.addRule(RelativeLayout.BELOW,mAudioButton.getId());
    topPane.addView(mAudioButton,audioParams);
    topPane.addView(mVideoButton,videoParams);
  }
 else {
    textParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
  }
  boolean textVisible=(mView_Text.getVisibility() != GONE);
  if (textVisible) {
    textParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    topPane.addView(mView_Text,textParams);
  }
  String errorMsg=null;
  View imageView=null;
  if (qrCodeContent != null) {
    Bitmap image;
    Display display=((WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
    int screenWidth=display.getWidth();
    int screenHeight=display.getHeight();
    int minimumDim=Math.min(screenWidth,screenHeight);
    try {
      QRCodeEncoder qrCodeEncoder=new QRCodeEncoder(qrCodeContent,minimumDim);
      image=qrCodeEncoder.encodeAsBitmap();
      mImageView=new ResizingImageView(getContext());
      mImageView.setPadding(10,10,10,10);
      mImageView.setAdjustViewBounds(true);
      mImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
      mImageView.setImageBitmap(image);
      mImageView.setId(23423534);
      imageView=mImageView;
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
 else   if (imageURI != null) {
    try {
      DisplayMetrics metrics=this.getContext().getResources().getDisplayMetrics();
      int maxWidth=metrics.widthPixels;
      int maxHeight=metrics.heightPixels;
      if (mView_Text != null) {
        maxHeight=maxHeight - mView_Text.getHeight();
      }
      if (mVideoButton != null) {
        maxHeight=maxHeight - mVideoButton.getHeight();
      }
 else       if (mAudioButton != null) {
        maxHeight=maxHeight - mAudioButton.getHeight();
      }
      maxHeight=(2 * maxHeight) / 3;
      final String imageFilename=ReferenceManager._().DeriveReference(imageURI).getLocalURI();
      final File imageFile=new File(imageFilename);
      if (imageFile.exists()) {
        Bitmap b=null;
        try {
          Display display=((WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
          int screenWidth=display.getWidth();
          int screenHeight=display.getHeight();
          b=FileUtils.getBitmapScaledToDisplay(imageFile,screenHeight,screenWidth);
        }
 catch (        OutOfMemoryError e) {
          errorMsg="String_Node_Str" + e.getMessage();
        }
        if (b != null) {
          ImageView mImageView=new ImageView(getContext());
          ;
          if (ResizingImageView.resizeMethod.equals("String_Node_Str") || ResizingImageView.resizeMethod.equals("String_Node_Str") || ResizingImageView.resizeMethod.equals("String_Node_Str")) {
            mImageView=new ResizingImageView(getContext(),imageURI,bigImageURI);
            mImageView.setAdjustViewBounds(true);
            mImageView.setMaxHeight(maxHeight);
            mImageView.setMaxWidth(maxWidth);
          }
          mImageView.setPadding(10,10,10,10);
          mImageView.setImageBitmap(b);
          mImageView.setId(23423534);
          imageView=mImageView;
        }
 else         if (errorMsg == null) {
          errorMsg=getContext().getString(R.string.file_invalid,imageFile);
        }
      }
 else {
        errorMsg=getContext().getString(R.string.file_missing,imageFile);
      }
      if (errorMsg != null) {
        Log.e(t,errorMsg);
        mMissingImage=new TextView(getContext());
        mMissingImage.setText(errorMsg);
        mMissingImage.setPadding(10,10,10,10);
        mMissingImage.setId(234873453);
        imageView=mMissingImage;
      }
    }
 catch (    InvalidReferenceException e) {
      Log.e(t,"String_Node_Str");
      e.printStackTrace();
    }
  }
  if (imageView != null) {
    RelativeLayout parent=this;
    imageParams.addRule(RelativeLayout.BELOW,topPane.getId());
    if (mAudioButton != null) {
      if (!textVisible) {
        imageParams.addRule(RelativeLayout.LEFT_OF,mAudioButton.getId());
        parent=topPane;
      }
    }
    if (mVideoButton != null) {
      if (!textVisible) {
        imageParams.addRule(RelativeLayout.LEFT_OF,mVideoButton.getId());
        parent=topPane;
      }
    }
    parent.addView(imageView,imageParams);
  }
}