Program: 37814
Project: 37814
Buggy source:
/** 
 * Load image request. Loads synchronously image specified by request. Adds loaded image to cache.
 * @param req image request
 * @param preview loading preview or not.
 * @return loaded image.
 */
public static Bitmap loadImage(final ImageManagerRequest req,final boolean preview){
  if (req == null) {
    return null;
  }
  if (logging) {
    Log.d(TAG,"String_Node_Str" + (preview ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ req);
  }
  Bitmap bmp=null;
  final Options opts=new Options();
  opts.inSampleSize=preview ? 8 : req.subsample;
  if (req.filename != null) {
    final File file=new File(req.filename);
    if (!file.exists() || file.isDirectory()) {
      if (logging) {
        Log.e(TAG,"String_Node_Str" + req + "String_Node_Str");
      }
      return null;
    }
    bmp=BitmapFactory.decodeFile(req.filename,opts);
    if (bmp == null && logging) {
      Log.e(TAG,"String_Node_Str" + req.filename);
    }
  }
 else   if (req.resId >= 0) {
    bmp=BitmapFactory.decodeResource(application.getResources(),req.resId,opts);
    if (bmp == null && logging) {
      Log.e(TAG,"String_Node_Str" + req.resId);
    }
  }
 else   if (req.uri != null) {
    try {
      final InputStream is=new URL(req.uri.toString()).openStream();
      bmp=BitmapFactory.decodeStream(is,null,opts);
      is.close();
      if (bmp == null && logging) {
        Log.e(TAG,"String_Node_Str" + req.uri);
      }
    }
 catch (    final Exception e) {
      if (logging) {
        Log.e(TAG,"String_Node_Str" + req.uri);
      }
    }
  }
  if (bmp == null) {
    return null;
  }
  if (!preview && (req.width > 0 && req.height > 0)) {
    final Bitmap sBmp=Bitmap.createScaledBitmap(bmp,req.width,req.height,true);
    if (sBmp != null) {
      bmp.recycle();
      bmp=sBmp;
    }
  }
  if (logging) {
    Log.d(TAG,(preview ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str" + req+ "String_Node_Str");
  }
  return bmp;
}

Fixed version (ground truth):
/** 
 * Load image request. Loads synchronously image specified by request. Adds loaded image to cache.
 * @param req image request
 * @param preview loading preview or not.
 * @return loaded image.
 */
public static Bitmap loadImage(final ImageManagerRequest req,final boolean preview){
  if (req == null) {
    return null;
  }
  if (logging) {
    Log.d(TAG,"String_Node_Str" + (preview ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ req);
  }
  Bitmap bmp=null;
  final Options opts=new Options();
  opts.inSampleSize=(preview ? 8 : 1) * req.subsample;
  if (req.filename != null) {
    final File file=new File(req.filename);
    if (!file.exists() || file.isDirectory()) {
      if (logging) {
        Log.e(TAG,"String_Node_Str" + req + "String_Node_Str");
      }
      return null;
    }
    bmp=BitmapFactory.decodeFile(req.filename,opts);
    if (bmp == null && logging) {
      Log.e(TAG,"String_Node_Str" + req.filename);
    }
  }
 else   if (req.resId >= 0) {
    bmp=BitmapFactory.decodeResource(application.getResources(),req.resId,opts);
    if (bmp == null && logging) {
      Log.e(TAG,"String_Node_Str" + req.resId);
    }
  }
 else   if (req.uri != null) {
    try {
      final InputStream is=new URL(req.uri.toString()).openStream();
      bmp=BitmapFactory.decodeStream(is,null,opts);
      is.close();
      if (bmp == null && logging) {
        Log.e(TAG,"String_Node_Str" + req.uri);
      }
    }
 catch (    final Exception e) {
      if (logging) {
        Log.e(TAG,"String_Node_Str" + req.uri);
      }
    }
  }
  if (bmp == null) {
    return null;
  }
  if (!preview && (req.width > 0 && req.height > 0)) {
    final Bitmap sBmp=Bitmap.createScaledBitmap(bmp,req.width,req.height,true);
    if (sBmp != bmp) {
      bmp.recycle();
      bmp=sBmp;
    }
  }
  if (logging) {
    Log.d(TAG,(preview ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str" + req+ "String_Node_Str");
  }
  return bmp;
}