Program: 2229
Project: 2229
Buggy source:
Drawable loadDrawable(TypedValue value,int id) throws NotFoundException {
  if (TRACE_FOR_PRELOAD) {
    if ((id >>> 24) == 0x1) {
      final String name=getResourceName(id);
      if (name != null)       android.util.Log.d("String_Node_Str",name);
    }
  }
  boolean isColorDrawable=false;
  if (value.type >= TypedValue.TYPE_FIRST_COLOR_INT && value.type <= TypedValue.TYPE_LAST_COLOR_INT) {
    isColorDrawable=true;
  }
  final long key=isColorDrawable ? value.data : (((long)value.assetCookie) << 32) | value.data;
  Drawable dr=getCachedDrawable(isColorDrawable ? mColorDrawableCache : mDrawableCache,key);
  if (dr != null) {
    return dr;
  }
  Drawable.ConstantState cs=isColorDrawable ? sPreloadedColorDrawables.get(key) : (sPreloadedDensity == mConfiguration.densityDpi ? sPreloadedDrawables.get(key) : null);
  if (cs != null) {
    dr=cs.newDrawable(this);
  }
 else {
    if (isColorDrawable) {
      dr=new ColorDrawable(value.data);
    }
    if (dr == null) {
      if (value.string == null) {
        throw new NotFoundException("String_Node_Str" + value);
      }
      String file=value.string.toString();
      if (TRACE_FOR_MISS_PRELOAD) {
        if ((id >>> 24) == 0x1) {
          final String name=getResourceName(id);
          if (name != null)           android.util.Log.d(TAG,"String_Node_Str" + Integer.toHexString(id) + "String_Node_Str"+ name+ "String_Node_Str"+ file);
        }
      }
      if (DEBUG_LOAD)       Log.v(TAG,"String_Node_Str" + value.assetCookie + "String_Node_Str"+ file);
      if (file.endsWith("String_Node_Str")) {
        Trace.traceBegin(Trace.TRACE_TAG_RESOURCES,file);
        try {
          XmlResourceParser rp=loadXmlResourceParser(file,id,value.assetCookie,"String_Node_Str");
          dr=Drawable.createFromXml(this,rp);
          rp.close();
        }
 catch (        Exception e) {
          Trace.traceEnd(Trace.TRACE_TAG_RESOURCES);
          NotFoundException rnf=new NotFoundException("String_Node_Str" + file + "String_Node_Str"+ Integer.toHexString(id));
          rnf.initCause(e);
          throw rnf;
        }
        Trace.traceEnd(Trace.TRACE_TAG_RESOURCES);
      }
 else {
        Trace.traceBegin(Trace.TRACE_TAG_RESOURCES,file);
        try {
          InputStream is=mAssets.openNonAsset(value.assetCookie,file,AssetManager.ACCESS_STREAMING);
          dr=Drawable.createFromResourceStream(this,value,is,file,null);
          is.close();
        }
 catch (        Exception e) {
          Trace.traceEnd(Trace.TRACE_TAG_RESOURCES);
          NotFoundException rnf=new NotFoundException("String_Node_Str" + file + "String_Node_Str"+ Integer.toHexString(id));
          rnf.initCause(e);
          throw rnf;
        }
        Trace.traceEnd(Trace.TRACE_TAG_RESOURCES);
      }
    }
  }
  if (dr != null) {
    dr.setChangingConfigurations(value.changingConfigurations);
    cs=dr.getConstantState();
    if (cs != null) {
      if (mPreloading) {
        if (verifyPreloadConfig(cs.getChangingConfigurations(),value.resourceId,"String_Node_Str")) {
          if (isColorDrawable) {
            sPreloadedColorDrawables.put(key,cs);
          }
 else {
            sPreloadedDrawables.put(key,cs);
          }
        }
      }
 else {
synchronized (mAccessLock) {
          if (isColorDrawable) {
            mColorDrawableCache.put(key,new WeakReference<Drawable.ConstantState>(cs));
          }
 else {
            mDrawableCache.put(key,new WeakReference<Drawable.ConstantState>(cs));
          }
        }
      }
    }
  }
  return dr;
}

Fixed version (ground truth):
Drawable loadDrawable(TypedValue value,int id) throws NotFoundException {
  if (TRACE_FOR_PRELOAD) {
    if ((id >>> 24) == 0x1) {
      final String name=getResourceName(id);
      if (name != null)       android.util.Log.d("String_Node_Str",name);
    }
  }
  boolean isColorDrawable=false;
  if (value.type >= TypedValue.TYPE_FIRST_COLOR_INT && value.type <= TypedValue.TYPE_LAST_COLOR_INT) {
    isColorDrawable=true;
  }
  final long key=isColorDrawable ? value.data : (((long)value.assetCookie) << 32) | value.data;
  Drawable dr=getCachedDrawable(isColorDrawable ? mColorDrawableCache : mDrawableCache,key);
  if (dr != null) {
    return dr;
  }
  final int layoutDirection=mConfiguration.getLayoutDirection();
  Drawable.ConstantState cs=isColorDrawable ? sPreloadedColorDrawables.get(key) : (sPreloadedDensity == mConfiguration.densityDpi ? sPreloadedDrawables[layoutDirection].get(key) : null);
  if (cs != null) {
    dr=cs.newDrawable(this);
  }
 else {
    if (isColorDrawable) {
      dr=new ColorDrawable(value.data);
    }
    if (dr == null) {
      if (value.string == null) {
        throw new NotFoundException("String_Node_Str" + value);
      }
      String file=value.string.toString();
      if (TRACE_FOR_MISS_PRELOAD) {
        if ((id >>> 24) == 0x1) {
          final String name=getResourceName(id);
          if (name != null)           android.util.Log.d(TAG,"String_Node_Str" + Integer.toHexString(id) + "String_Node_Str"+ name+ "String_Node_Str"+ file);
        }
      }
      if (DEBUG_LOAD)       Log.v(TAG,"String_Node_Str" + value.assetCookie + "String_Node_Str"+ file);
      if (file.endsWith("String_Node_Str")) {
        Trace.traceBegin(Trace.TRACE_TAG_RESOURCES,file);
        try {
          XmlResourceParser rp=loadXmlResourceParser(file,id,value.assetCookie,"String_Node_Str");
          dr=Drawable.createFromXml(this,rp);
          rp.close();
        }
 catch (        Exception e) {
          Trace.traceEnd(Trace.TRACE_TAG_RESOURCES);
          NotFoundException rnf=new NotFoundException("String_Node_Str" + file + "String_Node_Str"+ Integer.toHexString(id));
          rnf.initCause(e);
          throw rnf;
        }
        Trace.traceEnd(Trace.TRACE_TAG_RESOURCES);
      }
 else {
        Trace.traceBegin(Trace.TRACE_TAG_RESOURCES,file);
        try {
          InputStream is=mAssets.openNonAsset(value.assetCookie,file,AssetManager.ACCESS_STREAMING);
          dr=Drawable.createFromResourceStream(this,value,is,file,null);
          is.close();
        }
 catch (        Exception e) {
          Trace.traceEnd(Trace.TRACE_TAG_RESOURCES);
          NotFoundException rnf=new NotFoundException("String_Node_Str" + file + "String_Node_Str"+ Integer.toHexString(id));
          rnf.initCause(e);
          throw rnf;
        }
        Trace.traceEnd(Trace.TRACE_TAG_RESOURCES);
      }
    }
  }
  if (dr != null) {
    dr.setChangingConfigurations(value.changingConfigurations);
    cs=dr.getConstantState();
    if (cs != null) {
      if (mPreloading) {
        if (verifyPreloadConfig(cs.getChangingConfigurations(),value.resourceId,"String_Node_Str")) {
          if (isColorDrawable) {
            sPreloadedColorDrawables.put(key,cs);
          }
 else {
            sPreloadedDrawables[layoutDirection].put(key,cs);
          }
        }
      }
 else {
synchronized (mAccessLock) {
          if (isColorDrawable) {
            mColorDrawableCache.put(key,new WeakReference<Drawable.ConstantState>(cs));
          }
 else {
            mDrawableCache.put(key,new WeakReference<Drawable.ConstantState>(cs));
          }
        }
      }
    }
  }
  return dr;
}