Program: 90513
Project: 90513
Buggy source:
/** 
 * reconciles the given annotated method store containing the bean configuration with the configuration as read from the portlet deployment descriptor and the corresponding type annotations. <p> Portlets that are defined in the bean config are added to the portlet application definition if not already present. Event reference information from the annotations is verified and added to the corresponding portlet definition. <p> Methods from portlet classes definied in the portlet definitions are added to the annotated method store.
 * @param ams
 */
public void reconcileBeanConfig(AnnotatedMethodStore ams){
  Set<String> portletNames=ams.getPortletNames();
  portletNames.remove("String_Node_Str");
  if (isDebug) {
    StringBuilder txt=new StringBuilder();
    txt.append("String_Node_Str").append(portletNames.toString());
    LOG.debug(txt.toString());
  }
  ams.setDefaultNamespace(pad.getDefaultNamespace());
  for (  String pn : portletNames) {
    PortletDefinition pd=pad.getPortlet(pn);
    if (pd == null) {
      pd=new PortletDefinitionImpl(pn,pad);
    }
    if (pd.getSupports().isEmpty()) {
      Map<String,Supports> mimeSupps=new HashMap<String,Supports>();
      Set<MethodIdentifier> mis=ams.getMethodIDsForPortlet(pn);
      for (      MethodIdentifier mi : mis) {
        if (mi.getType() == MethodType.RENDER) {
          String mode=(String)mi.getId();
          if (mode.equalsIgnoreCase("String_Node_Str") || mode.equalsIgnoreCase("String_Node_Str") || mode.equalsIgnoreCase("String_Node_Str")) {
            List<AnnotatedMethod> meths=ams.getMethods(mi);
            for (            AnnotatedMethod meth : meths) {
              RenderMethod rm=(RenderMethod)meth.getAnnotation();
              String mimeType="String_Node_Str";
              if (rm != null) {
                mimeType=rm.contentType().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").toLowerCase();
                mimeType=mimeType.equals("String_Node_Str") ? "String_Node_Str" : mimeType;
              }
              Supports sup=mimeSupps.get(mimeType);
              if (sup == null) {
                sup=new SupportsImpl(mimeType);
                mimeSupps.put(mimeType,sup);
              }
              if (!sup.getPortletModes().contains(mode)) {
                sup.addPortletMode(mode);
              }
            }
          }
        }
      }
      for (      Supports sup : mimeSupps.values()) {
        pd.addSupports(sup);
      }
      if (isDebug) {
        StringBuilder txt=new StringBuilder();
        txt.append("String_Node_Str").append(mimeSupps.size()).append("String_Node_Str");
        for (        String mt : mimeSupps.keySet()) {
          txt.append("String_Node_Str").append(mt);
          txt.append("String_Node_Str");
          txt.append(((Supports)mimeSupps.get(mt)).getPortletModes().toString());
        }
        LOG.debug(txt.toString());
      }
    }
    Set<MethodIdentifier> mis=ams.getMethodIDsForPortlet(pn);
    for (    MethodIdentifier mi : mis) {
      if (mi.getType() == MethodType.RESOURCE) {
        List<AnnotatedMethod> meths=ams.getMethods(mi);
        for (        AnnotatedMethod meth : meths) {
          ServeResourceMethod srm=(ServeResourceMethod)meth.getAnnotation();
          if (srm != null && srm.asyncSupported()) {
            pd.setAsyncSupported(true);
          }
        }
      }
    }
    List<EventDefinitionReference> edrs=pd.getSupportedProcessingEvents();
    for (    QName qn : ams.getProcessingEventRefs(pn)) {
      EventDefinition ed=pad.getEventDefinition(qn);
      if (ed == null) {
        StringBuilder txt=new StringBuilder(128);
        txt.append("String_Node_Str");
        txt.append("String_Node_Str").append(pn);
        txt.append("String_Node_Str").append(qn);
        LOG.warn(txt.toString());
        MethodIdentifier mi=new MethodIdentifier(pd.getPortletName(),qn,MethodType.EVENT);
        ams.removeMethod(mi);
        continue;
      }
      EventDefinitionReference newedr=new EventDefinitionReferenceImpl(qn);
      if (!edrs.contains(newedr)) {
        pd.addSupportedProcessingEvent(newedr);
      }
    }
    edrs=pd.getSupportedPublishingEvents();
    for (    QName qn : ams.getPublishingEventRefs(pn)) {
      EventDefinition ed=pad.getEventDefinition(qn);
      if (ed == null) {
        StringBuilder txt=new StringBuilder(128);
        txt.append("String_Node_Str");
        txt.append("String_Node_Str").append(pn);
        txt.append("String_Node_Str").append(qn);
        LOG.warn(txt.toString());
        continue;
      }
      EventDefinitionReference newedr=new EventDefinitionReferenceImpl(qn);
      if (!edrs.contains(newedr)) {
        pd.addSupportedPublishingEvent(newedr);
      }
    }
    pad.addPortlet(pd);
  }
  List<PortletDefinition> badPortlets=new ArrayList<PortletDefinition>();
  for (  PortletDefinition pd : pad.getPortlets()) {
    Class<?> cls=null;
    String clsName=pd.getPortletClass();
    if (isValidIdentifier(clsName)) {
      Class<?> valClass=null;
      StringBuilder txt=new StringBuilder(128);
      try {
        ClassLoader cl=Thread.currentThread().getContextClassLoader();
        if (cl == null) {
          cl=this.getClass().getClassLoader();
        }
        valClass=cl.loadClass(clsName);
        if (Portlet.class.isAssignableFrom(valClass)) {
          cls=valClass;
        }
 else {
          txt.append("String_Node_Str");
        }
      }
 catch (      Exception e) {
        txt.append("String_Node_Str");
      }
 finally {
        if (cls == null) {
          txt.append("String_Node_Str").append(pd.getPortletName());
          txt.append("String_Node_Str").append(clsName);
          LOG.warn(txt.toString());
        }
      }
    }
    if (cls != null) {
      AnnotatedMethod am;
      am=getMethod(cls,"String_Node_Str",METH_INI);
      if (am != null) {
        MethodIdentifier mi=new MethodIdentifier(pd.getPortletName(),"String_Node_Str",MethodType.INIT);
        if (ams.getMethods(mi).size() == 0) {
          ams.addMethod(mi,am);
        }
      }
      am=getMethod(cls,"String_Node_Str",METH_DES);
      if (am != null) {
        MethodIdentifier mi=new MethodIdentifier(pd.getPortletName(),"String_Node_Str",MethodType.DESTROY);
        if (ams.getMethods(mi).size() == 0) {
          ams.addMethod(mi,am);
        }
      }
      am=getMethod(cls,"String_Node_Str",METH_ACT);
      if (am != null) {
        MethodIdentifier mi=new MethodIdentifier(pd.getPortletName(),"String_Node_Str",MethodType.ACTION);
        if (ams.getMethods(mi).size() == 0) {
          ams.addMethod(mi,am);
        }
      }
      am=getMethod(cls,"String_Node_Str",METH_EVT);
      if (am != null) {
        MethodIdentifier mi=new MethodIdentifier(pd.getPortletName(),"String_Node_Str",MethodType.EVENT);
        if (ams.getMethods(mi).size() == 0) {
          ams.addMethod(mi,am);
        }
      }
      am=getMethod(cls,"String_Node_Str",METH_REN);
      if (am != null) {
        MethodIdentifier mi=new MethodIdentifier(pd.getPortletName(),"String_Node_Str",MethodType.RENDER);
        if (ams.getMethods(mi).size() == 0) {
          ams.addMethod(mi,am);
        }
      }
      am=getMethod(cls,"String_Node_Str",METH_HDR);
      if (am != null) {
        MethodIdentifier mi=new MethodIdentifier(pd.getPortletName(),"String_Node_Str",MethodType.HEADER);
        if (ams.getMethods(mi).size() == 0) {
          ams.addMethod(mi,am);
        }
      }
      am=getMethod(cls,"String_Node_Str",METH_RES);
      if (am != null) {
        MethodIdentifier mi=new MethodIdentifier(pd.getPortletName(),"String_Node_Str",MethodType.RESOURCE);
        if (ams.getMethods(mi).size() == 0) {
          ams.addMethod(mi,am);
        }
      }
    }
    boolean methodsOK=false;
    for (    MethodIdentifier mi : ams.getMethodIDsForPortlet(pd.getPortletName())) {
      if ((mi.getType() == MethodType.RENDER) || (mi.getType() == MethodType.RESOURCE) || (mi.getType() == MethodType.HEADER)) {
        methodsOK=true;
        break;
      }
    }
    if (!methodsOK) {
      ams.removeMethodsForPortlet(pd.getPortletName());
      badPortlets.add(pd);
      StringBuilder txt=new StringBuilder();
      txt.append("String_Node_Str");
      txt.append("String_Node_Str").append(pd.getPortletName());
      LOG.warn(txt.toString());
    }
  }
  for (  PortletDefinition pd : badPortlets) {
    pad.removePortlet(pd);
  }
  if (isDebug) {
    StringBuilder txt=new StringBuilder();
    txt.append("String_Node_Str");
    Set<String> finalNames=ams.getPortletNames();
    finalNames.remove("String_Node_Str");
    txt.append("String_Node_Str").append(finalNames.toString());
    LOG.debug(txt.toString());
  }
}

Fixed version (ground truth):
/** 
 * reconciles the given annotated method store containing the bean configuration with the configuration as read from the portlet deployment descriptor and the corresponding type annotations. <p> Portlets that are defined in the bean config are added to the portlet application definition if not already present. Event reference information from the annotations is verified and added to the corresponding portlet definition. <p> Methods from portlet classes definied in the portlet definitions are added to the annotated method store.
 * @param ams
 */
public void reconcileBeanConfig(AnnotatedMethodStore ams){
  Set<String> portletNames=ams.getPortletNames();
  portletNames.remove("String_Node_Str");
  if (isDebug) {
    StringBuilder txt=new StringBuilder();
    txt.append("String_Node_Str").append(portletNames.toString());
    LOG.debug(txt.toString());
  }
  ams.setDefaultNamespace(pad.getDefaultNamespace());
  for (  String pn : portletNames) {
    PortletDefinition pd=pad.getPortlet(pn);
    if (pd == null) {
      pd=new PortletDefinitionImpl(pn,pad);
    }
    if (pd.getSupports().isEmpty()) {
      Map<String,Supports> mimeSupps=new HashMap<String,Supports>();
      Set<MethodIdentifier> mis=ams.getMethodIDsForPortlet(pn);
      for (      MethodIdentifier mi : mis) {
        if (mi.getType() == MethodType.RENDER) {
          String mode=(String)mi.getId();
          if (mode.equalsIgnoreCase("String_Node_Str") || mode.equalsIgnoreCase("String_Node_Str") || mode.equalsIgnoreCase("String_Node_Str")) {
            List<AnnotatedMethod> meths=ams.getMethods(mi);
            for (            AnnotatedMethod meth : meths) {
              RenderMethod rm=(RenderMethod)meth.getAnnotation();
              String mimeType="String_Node_Str";
              if (rm != null) {
                mimeType=rm.contentType().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").toLowerCase();
                mimeType=mimeType.equals("String_Node_Str") ? "String_Node_Str" : mimeType;
              }
              Supports sup=mimeSupps.get(mimeType);
              if (sup == null) {
                sup=new SupportsImpl(mimeType);
                mimeSupps.put(mimeType,sup);
              }
              if (!sup.getPortletModes().contains(mode)) {
                sup.addPortletMode(mode);
              }
            }
          }
        }
      }
      for (      Supports sup : mimeSupps.values()) {
        pd.addSupports(sup);
      }
      if (isDebug) {
        StringBuilder txt=new StringBuilder();
        txt.append("String_Node_Str").append(mimeSupps.size()).append("String_Node_Str");
        for (        String mt : mimeSupps.keySet()) {
          txt.append("String_Node_Str").append(mt);
          txt.append("String_Node_Str");
          txt.append(((Supports)mimeSupps.get(mt)).getPortletModes().toString());
        }
        LOG.debug(txt.toString());
      }
    }
    Set<MethodIdentifier> mis=ams.getMethodIDsForPortlet(pn);
    for (    MethodIdentifier mi : mis) {
      if (mi.getType() == MethodType.RESOURCE) {
        List<AnnotatedMethod> meths=ams.getMethods(mi);
        for (        AnnotatedMethod meth : meths) {
          ServeResourceMethod srm=(ServeResourceMethod)meth.getAnnotation();
          if (srm != null && srm.asyncSupported()) {
            pd.setAsyncSupported(true);
          }
        }
      }
    }
    List<EventDefinitionReference> edrs=pd.getSupportedProcessingEvents();
    for (    QName qn : ams.getProcessingEventRefs(pn)) {
      EventDefinition ed=pad.getEventDefinition(qn);
      if (ed == null) {
        StringBuilder txt=new StringBuilder(128);
        txt.append("String_Node_Str");
        txt.append("String_Node_Str").append(pn);
        txt.append("String_Node_Str").append(qn);
        LOG.warn(txt.toString());
        MethodIdentifier mi=new MethodIdentifier(pd.getPortletName(),qn,MethodType.EVENT);
        ams.removeMethod(mi);
        continue;
      }
      EventDefinitionReference newedr=new EventDefinitionReferenceImpl(qn);
      if (!edrs.contains(newedr)) {
        pd.addSupportedProcessingEvent(newedr);
      }
    }
    edrs=pd.getSupportedPublishingEvents();
    for (    QName qn : ams.getPublishingEventRefs(pn)) {
      EventDefinition ed=pad.getEventDefinition(qn);
      if (ed == null) {
        StringBuilder txt=new StringBuilder(128);
        txt.append("String_Node_Str");
        txt.append("String_Node_Str").append(pn);
        txt.append("String_Node_Str").append(qn);
        LOG.warn(txt.toString());
        continue;
      }
      EventDefinitionReference newedr=new EventDefinitionReferenceImpl(qn);
      if (!edrs.contains(newedr)) {
        pd.addSupportedPublishingEvent(newedr);
      }
    }
    pad.addPortlet(pd);
  }
  for (  PortletDefinition pd : pad.getPortlets()) {
    Class<?> cls=null;
    String clsName=pd.getPortletClass();
    if (isValidIdentifier(clsName)) {
      Class<?> valClass=null;
      StringBuilder txt=new StringBuilder(128);
      try {
        ClassLoader cl=Thread.currentThread().getContextClassLoader();
        if (cl == null) {
          cl=this.getClass().getClassLoader();
        }
        valClass=cl.loadClass(clsName);
        if (Portlet.class.isAssignableFrom(valClass)) {
          cls=valClass;
        }
 else {
          txt.append("String_Node_Str");
        }
      }
 catch (      Exception e) {
        txt.append("String_Node_Str");
      }
 finally {
        if (cls == null) {
          txt.append("String_Node_Str").append(pd.getPortletName());
          txt.append("String_Node_Str").append(clsName);
          LOG.warn(txt.toString());
        }
      }
    }
    if (cls != null) {
      AnnotatedMethod am;
      am=getMethod(cls,"String_Node_Str",METH_INI);
      if (am != null) {
        MethodIdentifier mi=new MethodIdentifier(pd.getPortletName(),"String_Node_Str",MethodType.INIT);
        if (ams.getMethods(mi).size() == 0) {
          ams.addMethod(mi,am);
        }
      }
      am=getMethod(cls,"String_Node_Str",METH_DES);
      if (am != null) {
        MethodIdentifier mi=new MethodIdentifier(pd.getPortletName(),"String_Node_Str",MethodType.DESTROY);
        if (ams.getMethods(mi).size() == 0) {
          ams.addMethod(mi,am);
        }
      }
      am=getMethod(cls,"String_Node_Str",METH_ACT);
      if (am != null) {
        MethodIdentifier mi=new MethodIdentifier(pd.getPortletName(),"String_Node_Str",MethodType.ACTION);
        if (ams.getMethods(mi).size() == 0) {
          ams.addMethod(mi,am);
        }
      }
      am=getMethod(cls,"String_Node_Str",METH_EVT);
      if (am != null) {
        MethodIdentifier mi=new MethodIdentifier(pd.getPortletName(),"String_Node_Str",MethodType.EVENT);
        if (ams.getMethods(mi).size() == 0) {
          ams.addMethod(mi,am);
        }
      }
      am=getMethod(cls,"String_Node_Str",METH_REN);
      if (am != null) {
        MethodIdentifier mi=new MethodIdentifier(pd.getPortletName(),"String_Node_Str",MethodType.RENDER);
        if (ams.getMethods(mi).size() == 0) {
          ams.addMethod(mi,am);
        }
      }
      am=getMethod(cls,"String_Node_Str",METH_HDR);
      if (am != null) {
        MethodIdentifier mi=new MethodIdentifier(pd.getPortletName(),"String_Node_Str",MethodType.HEADER);
        if (ams.getMethods(mi).size() == 0) {
          ams.addMethod(mi,am);
        }
      }
      am=getMethod(cls,"String_Node_Str",METH_RES);
      if (am != null) {
        MethodIdentifier mi=new MethodIdentifier(pd.getPortletName(),"String_Node_Str",MethodType.RESOURCE);
        if (ams.getMethods(mi).size() == 0) {
          ams.addMethod(mi,am);
        }
      }
    }
  }
  Set<MethodIdentifier> mis=ams.getMethodIDsForPortlet("String_Node_Str");
  if (isDebug) {
    StringBuilder txt=new StringBuilder();
    txt.append("String_Node_Str");
    String sep="String_Node_Str";
    for (    MethodIdentifier mi : mis) {
      txt.append(sep).append(mi.toString());
      sep="String_Node_Str";
    }
    LOG.debug(txt.toString());
  }
  for (  MethodIdentifier mi : mis) {
    List<AnnotatedMethod> meths=ams.getMethods(mi);
    for (    PortletDefinition pd : pad.getPortlets()) {
      MethodIdentifier newMi=new MethodIdentifier(pd.getPortletName(),mi.getId(),mi.getType());
      for (      AnnotatedMethod meth : meths) {
        ams.addMethod(newMi,meth);
      }
    }
  }
  List<PortletDefinition> badPortlets=new ArrayList<PortletDefinition>();
  for (  PortletDefinition pd : pad.getPortlets()) {
    boolean methodsOK=false;
    for (    MethodIdentifier mi : ams.getMethodIDsForPortlet(pd.getPortletName())) {
      if ((mi.getType() == MethodType.RENDER) || (mi.getType() == MethodType.RESOURCE) || (mi.getType() == MethodType.HEADER)) {
        methodsOK=true;
        break;
      }
    }
    if (!methodsOK) {
      ams.removeMethodsForPortlet(pd.getPortletName());
      badPortlets.add(pd);
      StringBuilder txt=new StringBuilder();
      txt.append("String_Node_Str");
      txt.append("String_Node_Str").append(pd.getPortletName());
      LOG.warn(txt.toString());
    }
  }
  for (  PortletDefinition pd : badPortlets) {
    pad.removePortlet(pd);
  }
  if (isDebug) {
    StringBuilder txt=new StringBuilder();
    txt.append("String_Node_Str");
    Set<String> finalNames=ams.getPortletNames();
    finalNames.remove("String_Node_Str");
    txt.append("String_Node_Str").append(finalNames.toString());
    LOG.debug(txt.toString());
  }
  if (isTrace) {
    StringBuilder txt=new StringBuilder();
    txt.append(ams.getMethodsAsString());
    LOG.trace(txt.toString());
  }
}