Program: 29070
Project: 29070
Buggy source:
/** 
 * write assembly-descriptor related xml information to the DOM tree
 */
private void writeAssemblyDescriptor(Node parentNode,EjbBundleDescriptorImpl bundleDescriptor){
  Node assemblyNode=parentNode.getOwnerDocument().createElement(EjbTagNames.ASSEMBLY_DESCRIPTOR);
  SecurityRoleNode roleNode=new SecurityRoleNode();
  for (Iterator e=bundleDescriptor.getRoles().iterator(); e.hasNext(); ) {
    roleNode.writeDescriptor(assemblyNode,TagNames.ROLE,(Role)e.next());
  }
  Map excludedMethodsByEjb=new HashMap();
  MethodPermissionNode mpNode=new MethodPermissionNode();
  for (  EjbDescriptor ejbDesc : bundleDescriptor.getEjbs()) {
    if (ejbDesc instanceof EjbMessageBeanDescriptor)     continue;
    Vector excludedMethods=new Vector();
    addMethodPermissions(ejbDesc,ejbDesc.getPermissionedMethodsByPermission(),excludedMethods,mpNode,assemblyNode);
    addMethodPermissions(ejbDesc,ejbDesc.getStyledPermissionedMethodsByPermission(),excludedMethods,mpNode,assemblyNode);
    if (excludedMethods.size() > 0) {
      excludedMethodsByEjb.put(ejbDesc,excludedMethods);
    }
  }
  ContainerTransactionNode ctNode=new ContainerTransactionNode();
  for (  EjbDescriptor ejbDesc : bundleDescriptor.getEjbs()) {
    ctNode.writeDescriptor(assemblyNode,EjbTagNames.CONTAINER_TRANSACTION,ejbDesc);
  }
  InterceptorBindingNode ibNode=new InterceptorBindingNode();
  for (  EjbDescriptor ejbDesc : bundleDescriptor.getEjbs()) {
    if (!ejbDesc.getInterceptorClasses().isEmpty()) {
      ibNode.writeBindings(assemblyNode,ejbDesc);
    }
  }
  writeMessageDestinations(assemblyNode,bundleDescriptor.getMessageDestinations().iterator());
  if (excludedMethodsByEjb.size() > 0) {
    Node excludeListNode=this.appendChild(assemblyNode,EjbTagNames.EXCLUDE_LIST);
    for (Iterator ejbs=excludedMethodsByEjb.keySet().iterator(); ejbs.hasNext(); ) {
      EjbDescriptor ejbDesc=(EjbDescriptor)ejbs.next();
      Vector excludedMethods=(Vector)excludedMethodsByEjb.get(ejbDesc);
      MethodPermissionDescriptor mpd=new MethodPermissionDescriptor();
      mpd.addMethodPermission(MethodPermission.getExcludedMethodPermission());
      mpd.addMethods(excludedMethods);
      mpNode.writeDescriptorInNode(excludeListNode,mpd,ejbDesc);
    }
  }
  for (  EjbApplicationExceptionInfo next : bundleDescriptor.getApplicationExceptions().values()) {
    EjbApplicationExceptionNode node=new EjbApplicationExceptionNode();
    node.writeDescriptor(assemblyNode,EjbTagNames.APPLICATION_EXCEPTION,next);
  }
  if (assemblyNode.hasChildNodes()) {
    parentNode.appendChild(assemblyNode);
  }
}

Fixed version (ground truth):
/** 
 * write assembly-descriptor related xml information to the DOM tree
 */
private void writeAssemblyDescriptor(Node parentNode,EjbBundleDescriptorImpl bundleDescriptor){
  Node assemblyNode=parentNode.getOwnerDocument().createElement(EjbTagNames.ASSEMBLY_DESCRIPTOR);
  SecurityRoleNode roleNode=new SecurityRoleNode();
  for (Iterator e=bundleDescriptor.getRoles().iterator(); e.hasNext(); ) {
    roleNode.writeDescriptor(assemblyNode,TagNames.ROLE,(Role)e.next());
  }
  Map excludedMethodsByEjb=new HashMap();
  MethodPermissionNode mpNode=new MethodPermissionNode();
  for (  EjbDescriptor ejbDesc : bundleDescriptor.getEjbs()) {
    if (ejbDesc instanceof EjbMessageBeanDescriptor)     continue;
    Vector excludedMethods=new Vector();
    addMethodPermissions(ejbDesc,ejbDesc.getPermissionedMethodsByPermission(),excludedMethods,mpNode,assemblyNode);
    addMethodPermissions(ejbDesc,ejbDesc.getStyledPermissionedMethodsByPermission(),excludedMethods,mpNode,assemblyNode);
    if (excludedMethods.size() > 0) {
      excludedMethodsByEjb.put(ejbDesc,excludedMethods);
    }
  }
  ContainerTransactionNode ctNode=new ContainerTransactionNode();
  for (  EjbDescriptor ejbDesc : bundleDescriptor.getEjbs()) {
    ctNode.writeDescriptor(assemblyNode,EjbTagNames.CONTAINER_TRANSACTION,ejbDesc);
  }
  InterceptorBindingNode ibNode=new InterceptorBindingNode();
  for (  EjbDescriptor ejbDesc : bundleDescriptor.getEjbs()) {
    if (!ejbDesc.getInterceptorClasses().isEmpty()) {
      ibNode.writeBindings(assemblyNode,ejbDesc);
    }
  }
  writeMessageDestinations(assemblyNode,bundleDescriptor.getMessageDestinations().iterator());
  if (excludedMethodsByEjb.size() > 0) {
    Node excludeListNode=this.appendChild(assemblyNode,EjbTagNames.EXCLUDE_LIST);
    for (    Object o : excludedMethodsByEjb.entrySet()) {
      Map.Entry entry=(Map.Entry)o;
      EjbDescriptor ejbDesc=(EjbDescriptor)entry.getKey();
      Vector excludedMethods=(Vector)entry.getValue();
      MethodPermissionDescriptor mpd=new MethodPermissionDescriptor();
      mpd.addMethodPermission(MethodPermission.getExcludedMethodPermission());
      mpd.addMethods(excludedMethods);
      mpNode.writeDescriptorInNode(excludeListNode,mpd,ejbDesc);
    }
  }
  for (  EjbApplicationExceptionInfo next : bundleDescriptor.getApplicationExceptions().values()) {
    EjbApplicationExceptionNode node=new EjbApplicationExceptionNode();
    node.writeDescriptor(assemblyNode,EjbTagNames.APPLICATION_EXCEPTION,next);
  }
  if (assemblyNode.hasChildNodes()) {
    parentNode.appendChild(assemblyNode);
  }
}