Program: 15189
Project: 15189
Buggy source:
public SpannableStringBuilder addMediaFromShareAction(String imgPath,Uri curStream,SpannableStringBuilder ssb){
  Bitmap resizedBitmap=null;
  String imageTitle="String_Node_Str";
  ImageHelper ih=new ImageHelper();
  Display display=getWindowManager().getDefaultDisplay();
  int width=display.getWidth();
  HashMap<?,?> mediaData=ih.getImageBytesForPath(imgPath,EditPost.this);
  if (mediaData == null) {
    return null;
  }
  byte[] finalBytes=ih.createThumbnail((byte[])mediaData.get("String_Node_Str"),String.valueOf(width / 2),(String)mediaData.get("String_Node_Str"),true);
  resizedBitmap=BitmapFactory.decodeByteArray(finalBytes,0,finalBytes.length);
  WPImageSpan is=new WPImageSpan(EditPost.this,resizedBitmap,curStream);
  String imageWidth=WordPress.currentBlog.getMaxImageWidth();
  if (!imageWidth.equals("String_Node_Str")) {
    try {
      is.setWidth(Integer.valueOf(imageWidth));
    }
 catch (    NumberFormatException e) {
      e.printStackTrace();
    }
  }
  is.setTitle(imageTitle);
  is.setImageSource(curStream);
  is.setVideo(imgPath.contains("String_Node_Str"));
  ssb.append("String_Node_Str");
  ssb.setSpan(is,ssb.length() - 1,ssb.length(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
  AlignmentSpan.Standard as=new AlignmentSpan.Standard(Layout.Alignment.ALIGN_CENTER);
  ssb.setSpan(as,ssb.length() - 1,ssb.length(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
  ssb.append("String_Node_Str");
  return ssb;
}

Fixed version (ground truth):
public SpannableStringBuilder addMediaFromShareAction(String imgPath,Uri curStream,SpannableStringBuilder ssb){
  Bitmap resizedBitmap=null;
  String imageTitle="String_Node_Str";
  ImageHelper ih=new ImageHelper();
  Display display=getWindowManager().getDefaultDisplay();
  int width=display.getWidth();
  HashMap<?,?> mediaData=ih.getImageBytesForPath(imgPath,EditPost.this);
  if (mediaData == null) {
    return null;
  }
  BitmapFactory.Options opts=new BitmapFactory.Options();
  opts.inJustDecodeBounds=true;
  byte[] bytes=(byte[])mediaData.get("String_Node_Str");
  BitmapFactory.decodeByteArray(bytes,0,bytes.length,opts);
  float conversionFactor=0.25f;
  if (opts.outWidth > opts.outHeight)   conversionFactor=0.40f;
  byte[] finalBytes=ih.createThumbnail((byte[])mediaData.get("String_Node_Str"),String.valueOf((int)(width * conversionFactor)),(String)mediaData.get("String_Node_Str"),true);
  resizedBitmap=BitmapFactory.decodeByteArray(finalBytes,0,finalBytes.length);
  WPImageSpan is=new WPImageSpan(EditPost.this,resizedBitmap,curStream);
  String imageWidth=WordPress.currentBlog.getMaxImageWidth();
  if (!imageWidth.equals("String_Node_Str")) {
    try {
      is.setWidth(Integer.valueOf(imageWidth));
    }
 catch (    NumberFormatException e) {
      e.printStackTrace();
    }
  }
  is.setTitle(imageTitle);
  is.setImageSource(curStream);
  is.setVideo(imgPath.contains("String_Node_Str"));
  ssb.append("String_Node_Str");
  ssb.setSpan(is,ssb.length() - 1,ssb.length(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
  AlignmentSpan.Standard as=new AlignmentSpan.Standard(Layout.Alignment.ALIGN_CENTER);
  ssb.setSpan(as,ssb.length() - 1,ssb.length(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
  ssb.append("String_Node_Str");
  return ssb;
}