Program: 152967
Project: 152967
Buggy source:
/** 
 * A best-guess attempt at figuring out why the class could not be found.
 * @param name of the class we are trying to find.
 */
private synchronized void debugClassLoading(String name,String root){
  Dictionary dict=backingBundle.getHeaders();
  String bname=dict.get(Constants.BUNDLE_NAME) + "String_Node_Str" + dict.get(Constants.BUNDLE_SYMBOLICNAME)+ "String_Node_Str";
  if (log.isTraceEnabled())   log.trace("String_Node_Str" + name + "String_Node_Str"+ bname+ "String_Node_Str");
  BundleContext context=OsgiBundleUtils.getBundleContext(backingBundle);
  String packageName=name.substring(0,name.lastIndexOf('.'));
  if (name.indexOf('.') < 0) {
    if (log.isTraceEnabled())     log.trace("String_Node_Str");
    return;
  }
  Version iversion=hasImport(backingBundle,packageName);
  if (iversion != null && context != null) {
    if (log.isTraceEnabled())     log.trace("String_Node_Str" + iversion + "String_Node_Str");
    Bundle[] bundles=context.getBundles();
    for (int i=0; i < bundles.length; i++) {
      if (bundles[i].getBundleId() != backingBundle.getBundleId()) {
        Version exported=checkBundleForClass(bundles[i],name,iversion);
        if (exported != null && exported.equals(iversion) && root != null) {
          for (int j=0; j < bundles.length; j++) {
            Version rootexport=hasExport(bundles[j],root.substring(0,root.lastIndexOf('.')));
            if (rootexport != null) {
              Version rootimport=hasImport(bundles[j],packageName);
              if (rootimport == null || !rootimport.equals(iversion)) {
                if (log.isTraceEnabled())                 log.trace("String_Node_Str" + getBundleName(bundles[j]) + "String_Node_Str"+ root+ "String_Node_Str"+ rootexport+ "String_Node_Str"+ packageName+ "String_Node_Str"+ iversion+ "String_Node_Str");
              }
            }
          }
        }
      }
    }
  }
  if (hasExport(backingBundle,packageName) != null) {
    if (log.isTraceEnabled())     log.trace("String_Node_Str");
    checkBundleForClass(backingBundle,name,iversion);
  }
}

Fixed version (ground truth):
/** 
 * A best-guess attempt at figuring out why the class could not be found.
 * @param name of the class we are trying to find.
 */
public static void debugClassLoading(Bundle backingBundle,String name,String root){
  Dictionary dict=backingBundle.getHeaders();
  String bname=dict.get(Constants.BUNDLE_NAME) + "String_Node_Str" + dict.get(Constants.BUNDLE_SYMBOLICNAME)+ "String_Node_Str";
  if (log.isTraceEnabled())   log.trace("String_Node_Str" + name + "String_Node_Str"+ bname+ "String_Node_Str");
  BundleContext context=OsgiBundleUtils.getBundleContext(backingBundle);
  String packageName=name.substring(0,name.lastIndexOf('.'));
  if (name.indexOf('.') < 0) {
    if (log.isTraceEnabled())     log.trace("String_Node_Str");
    return;
  }
  Version iversion=hasImport(backingBundle,packageName);
  if (iversion != null && context != null) {
    if (log.isTraceEnabled())     log.trace("String_Node_Str" + iversion + "String_Node_Str");
    Bundle[] bundles=context.getBundles();
    for (int i=0; i < bundles.length; i++) {
      if (bundles[i].getBundleId() != backingBundle.getBundleId()) {
        Version exported=checkBundleForClass(bundles[i],name,iversion);
        if (exported != null && exported.equals(iversion) && root != null) {
          for (int j=0; j < bundles.length; j++) {
            Version rootexport=hasExport(bundles[j],root.substring(0,root.lastIndexOf('.')));
            if (rootexport != null) {
              Version rootimport=hasImport(bundles[j],packageName);
              if (rootimport == null || !rootimport.equals(iversion)) {
                if (log.isTraceEnabled())                 log.trace("String_Node_Str" + getBundleName(bundles[j]) + "String_Node_Str"+ root+ "String_Node_Str"+ rootexport+ "String_Node_Str"+ packageName+ "String_Node_Str"+ iversion+ "String_Node_Str");
              }
            }
          }
        }
      }
    }
  }
  if (hasExport(backingBundle,packageName) != null) {
    if (log.isTraceEnabled())     log.trace("String_Node_Str");
    checkBundleForClass(backingBundle,name,iversion);
  }
}