Program: 47298
Project: 47298
Buggy source:
/** 
 * Returns as many folders as plugins providing root folders are loaded into memory (need to implement AdditionalFolder(s)AtRoot)
 */
private List<DLNAResource> getAdditionalFoldersAtRoot(){
  List<DLNAResource> res=new ArrayList<DLNAResource>();
  for (  ExternalListener listener : ExternalFactory.getExternalListeners()) {
    if (listener instanceof AdditionalFolderAtRoot) {
      AdditionalFolderAtRoot afar=(AdditionalFolderAtRoot)listener;
      try {
        DLNAResource resource=afar.getChild();
        LOGGER.debug("String_Node_Str" + listener + "String_Node_Str"+ (listener instanceof LastPlayedParent));
        if (listener instanceof LastPlayedParent) {
          resource.setMasterParent((LastPlayedParent)listener);
          for (          DLNAResource r : resource.getChildren()) {
            r.setMasterParent((LastPlayedParent)listener);
          }
        }
        res.add(resource);
      }
 catch (      Throwable t) {
        LOGGER.error(String.format("String_Node_Str",afar.name(),afar.getClass()),t);
      }
    }
 else     if (listener instanceof AdditionalFoldersAtRoot) {
      java.util.Iterator<DLNAResource> folders=((AdditionalFoldersAtRoot)listener).getChildren();
      while (folders.hasNext()) {
        DLNAResource resource=folders.next();
        if (listener instanceof LastPlayedParent) {
          resource.setMasterParent((LastPlayedParent)listener);
          for (          DLNAResource r : resource.getChildren()) {
            r.setMasterParent((LastPlayedParent)listener);
          }
        }
        try {
          res.add(resource);
        }
 catch (        Throwable t) {
          LOGGER.error(String.format("String_Node_Str",listener.getClass(),resource.getClass()),t);
        }
      }
    }
  }
  return res;
}

Fixed version (ground truth):
/** 
 * Returns as many folders as plugins providing root folders are loaded into memory (need to implement AdditionalFolder(s)AtRoot)
 */
private List<DLNAResource> getAdditionalFoldersAtRoot(){
  List<DLNAResource> res=new ArrayList<DLNAResource>();
  for (  ExternalListener listener : ExternalFactory.getExternalListeners()) {
    if (listener instanceof AdditionalFolderAtRoot) {
      AdditionalFolderAtRoot afar=(AdditionalFolderAtRoot)listener;
      try {
        DLNAResource resource=afar.getChild();
        LOGGER.debug("String_Node_Str" + listener);
        resource.setMasterParent(listener);
        for (        DLNAResource r : resource.getChildren()) {
          r.setMasterParent(listener);
        }
        res.add(resource);
      }
 catch (      Throwable t) {
        LOGGER.error(String.format("String_Node_Str",afar.name(),afar.getClass()),t);
      }
    }
 else     if (listener instanceof AdditionalFoldersAtRoot) {
      java.util.Iterator<DLNAResource> folders=((AdditionalFoldersAtRoot)listener).getChildren();
      while (folders.hasNext()) {
        DLNAResource resource=folders.next();
        resource.setMasterParent(listener);
        for (        DLNAResource r : resource.getChildren()) {
          r.setMasterParent(listener);
        }
        try {
          res.add(resource);
        }
 catch (        Throwable t) {
          LOGGER.error(String.format("String_Node_Str",listener.getClass(),resource.getClass()),t);
        }
      }
    }
  }
  return res;
}