Program: 90606
Project: 90606
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){
  if (isDebug) {
    StringBuilder txt=new StringBuilder();
    txt.append("String_Node_Str").append(ams.getPortletNames().toString());
    LOG.debug(txt.toString());
  }
  ams.setDefaultNamespace(pad.getDefaultNamespace());
  for (  String pn : ams.getPortletNames()) {
    PortletDefinition pd=pad.getPortlet(pn);
    if (pd == null) {
      pd=new PortletDefinitionImpl(pn,pad);
    }
    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());
        }
      }
    }
    Object instance=null;
    if (cls != null) {
      StringBuilder txt=new StringBuilder(128);
      BeanManager bm=ams.getBeanMgr();
      if (bm == null) {
        txt.append("String_Node_Str");
      }
 else {
        Set<Bean<?>> beans=bm.getBeans(cls);
        if (beans == null || beans.size() == 0) {
          txt.append("String_Node_Str");
        }
 else {
          Bean<?> bean=bm.resolve(beans);
          if (bean == null) {
            txt.append("String_Node_Str");
          }
 else {
            instance=bm.getReference(bean,bean.getBeanClass(),bm.createCreationalContext(bean));
            if (instance == null) {
              txt.append("String_Node_Str");
            }
          }
        }
      }
      if (instance == null) {
        LOG.debug("String_Node_Str" + cls.getCanonicalName());
        try {
          instance=cls.newInstance();
        }
 catch (        Exception e) {
          txt.append("String_Node_Str").append(e.toString());
        }
      }
      if ((instance == null) && (txt.length() > 0)) {
        txt.append("String_Node_Str").append(pd.getPortletName());
        txt.append("String_Node_Str").append(cls);
        LOG.warn(txt.toString());
      }
    }
    if (instance != null) {
      ams.setPortletClassInstance(cls,instance);
      AnnotatedMethod am;
      am=getMethod(instance,"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(instance,"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(instance,"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(instance,"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(instance,"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(instance,"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(instance,"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");
    txt.append("String_Node_Str").append(ams.getPortletNames().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){
  if (isDebug) {
    StringBuilder txt=new StringBuilder();
    txt.append("String_Node_Str").append(ams.getPortletNames().toString());
    LOG.debug(txt.toString());
  }
  ams.setDefaultNamespace(pad.getDefaultNamespace());
  for (  String pn : ams.getPortletNames()) {
    PortletDefinition pd=pad.getPortlet(pn);
    if (pd == null) {
      pd=new PortletDefinitionImpl(pn,pad);
    }
    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());
        }
      }
    }
    Object instance=null;
    if (cls != null) {
      StringBuilder txt=new StringBuilder(128);
      BeanManager bm=ams.getBeanMgr();
      if (bm == null) {
        txt.append("String_Node_Str");
      }
 else {
        Set<Bean<?>> beans=bm.getBeans(cls);
        if (beans == null || beans.size() == 0) {
          txt.append("String_Node_Str");
        }
 else {
          Bean<?> bean=bm.resolve(beans);
          if (bean == null) {
            txt.append("String_Node_Str");
          }
 else {
            instance=bm.getReference(bean,bean.getBeanClass(),bm.createCreationalContext(bean));
            if (instance == null) {
              txt.append("String_Node_Str");
            }
          }
        }
      }
      if (instance == null) {
        LOG.debug("String_Node_Str" + cls.getCanonicalName());
        try {
          instance=cls.newInstance();
        }
 catch (        Exception e) {
          txt.append("String_Node_Str").append(e.toString());
        }
      }
      if ((instance == null) && (txt.length() > 0)) {
        txt.append("String_Node_Str").append(pd.getPortletName());
        txt.append("String_Node_Str").append(cls);
        LOG.warn(txt.toString());
      }
    }
    if (instance != null) {
      ams.setPortletClassInstance(pd.getPortletName(),cls,instance);
      AnnotatedMethod am;
      am=getMethod(instance,"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(instance,"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(instance,"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(instance,"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(instance,"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(instance,"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(instance,"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");
    txt.append("String_Node_Str").append(ams.getPortletNames().toString());
    LOG.debug(txt.toString());
  }
}