Program: 135776
Project: 135776
Buggy source:
protected void populateViewContext(String path,PortletRequest portletRequest,PortletResponse portletResponse,Template template,TemplateHashModel staticModels) throws Exception {
  ThemeDisplay themeDisplay=(ThemeDisplay)portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
  PortletPreferences portletPreferences=portletRequest.getPreferences();
  long assetEntryIdDefault=GetterUtil.getLong(portletPreferences.getValue("String_Node_Str",null));
  boolean contentDefaultValue=GetterUtil.getBoolean(portletPreferences.getValue("String_Node_Str",null));
  populatePortletDisplayTemplateContext(template,portletPreferences,themeDisplay.getScopeGroupId(),"String_Node_Str");
  if (Validator.isNull(path) || path.equals(CampaignContentDisplayPath.VIEW)) {
    template.put("String_Node_Str",showPreview(themeDisplay));
    template.put("String_Node_Str",contentDefaultValue);
    List<QueryRule> campaignQueryRules=CampaignQueryRuleUtil.getCampaignQueryRules(portletPreferences,themeDisplay.getLocale());
    template.put("String_Node_Str",campaignQueryRules);
    QueryRule queryRule=null;
    long[] userSegmentIds=(long[])portletRequest.getAttribute(WebKeys.USER_SEGMENT_IDS);
    if (userSegmentIds != null) {
      long[] groupIds=ContentTargetingUtil.getAncestorsAndCurrentGroupIds(themeDisplay.getSiteGroupId());
      List<Campaign> campaigns=_campaignLocalService.getCampaigns(groupIds,userSegmentIds);
      queryRule=CampaignQueryRuleUtil.match(getCampaignIds(campaigns),campaignQueryRules);
      template.put("String_Node_Str",queryRule);
    }
    template.put("String_Node_Str",campaignQueryRules.indexOf(queryRule));
    template.put("String_Node_Str",Campaign.class.getName());
    List<AssetEntry> results=new ArrayList<AssetEntry>();
    if ((queryRule != null) && (queryRule.getAssetEntry() != null)) {
      results.add(queryRule.getAssetEntry());
      queryRule.setAssetAttributes(portletRequest);
    }
 else {
      portletRequest.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY,Boolean.TRUE);
    }
    template.put("String_Node_Str",LiferayWindowState.POP_UP);
    populatePortletDisplayTemplateViewContext(template,portletRequest,themeDisplay,results,campaignQueryRules);
  }
 else   if (path.equals(CampaignContentDisplayPath.EDIT_QUERY_RULE) || path.equals(CampaignContentDisplayPath.CONFIGURATION)) {
    template.put("String_Node_Str",getSelectableAssetRendererFactories(themeDisplay.getCompanyId()));
    String assetImageDefault=StringPool.BLANK;
    String assetTitleDefault=StringPool.BLANK;
    String assetTypeDefault=StringPool.BLANK;
    if (assetEntryIdDefault > 0) {
      AssetEntry assetEntry=AssetEntryLocalServiceUtil.fetchAssetEntry(assetEntryIdDefault);
      AssetRendererFactory assetRendererFactory=AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(assetEntry.getClassName());
      AssetRenderer assetRenderer=assetRendererFactory.getAssetRenderer(assetEntry.getClassPK());
      assetImageDefault=assetRenderer.getThumbnailPath(portletRequest);
      assetTitleDefault=assetRenderer.getTitle(themeDisplay.getLocale());
      assetTypeDefault=assetRendererFactory.getTypeName(themeDisplay.getLocale(),true);
    }
    List<Campaign> campaigns=_campaignService.getCampaigns(themeDisplay.getSiteGroupIdOrLiveGroupId());
    template.put("String_Node_Str",campaigns);
    template.put("String_Node_Str",assetEntryIdDefault);
    template.put("String_Node_Str",assetImageDefault);
    template.put("String_Node_Str",assetTitleDefault);
    template.put("String_Node_Str",assetTypeDefault);
    template.put("String_Node_Str",contentDefaultValue);
    template.put("String_Node_Str",LiferayWindowState.EXCLUSIVE);
    template.put("String_Node_Str",portletPreferences);
    int[] queryRulesIndexes=GetterUtil.getIntegerValues(portletPreferences.getValues("String_Node_Str",null),new int[]{0});
    template.put("String_Node_Str",queryRulesIndexes);
    template.put("String_Node_Str",staticModels.get(CampaignQueryRuleUtil.class.getName()));
    template.put("String_Node_Str",staticModels.get(UserSegmentContentDisplayUtil.class.getName()));
  }
}

Fixed version (ground truth):
protected void populateViewContext(String path,PortletRequest portletRequest,PortletResponse portletResponse,Template template,TemplateHashModel staticModels) throws Exception {
  ThemeDisplay themeDisplay=(ThemeDisplay)portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
  PortletPreferences portletPreferences=portletRequest.getPreferences();
  long assetEntryIdDefault=GetterUtil.getLong(portletPreferences.getValue("String_Node_Str",null));
  boolean contentDefaultValue=GetterUtil.getBoolean(portletPreferences.getValue("String_Node_Str",null));
  populatePortletDisplayTemplateContext(template,portletPreferences,themeDisplay.getScopeGroupId(),"String_Node_Str");
  if (Validator.isNull(path) || path.equals(CampaignContentDisplayPath.VIEW)) {
    template.put("String_Node_Str",showPreview(themeDisplay));
    template.put("String_Node_Str",contentDefaultValue);
    List<QueryRule> campaignQueryRules=CampaignQueryRuleUtil.getCampaignQueryRules(portletPreferences,themeDisplay.getLocale());
    template.put("String_Node_Str",campaignQueryRules);
    QueryRule queryRule=campaignQueryRules.get(0);
    long[] userSegmentIds=(long[])portletRequest.getAttribute(WebKeys.USER_SEGMENT_IDS);
    if (userSegmentIds != null) {
      long[] groupIds=ContentTargetingUtil.getAncestorsAndCurrentGroupIds(themeDisplay.getSiteGroupId());
      List<Campaign> campaigns=_campaignLocalService.getCampaigns(groupIds,userSegmentIds);
      queryRule=CampaignQueryRuleUtil.match(getCampaignIds(campaigns),campaignQueryRules);
    }
    template.put("String_Node_Str",queryRule);
    template.put("String_Node_Str",campaignQueryRules.indexOf(queryRule));
    template.put("String_Node_Str",Campaign.class.getName());
    List<AssetEntry> results=new ArrayList<AssetEntry>();
    if ((queryRule != null) && (queryRule.getAssetEntry() != null)) {
      results.add(queryRule.getAssetEntry());
      queryRule.setAssetAttributes(portletRequest);
    }
 else {
      portletRequest.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY,Boolean.TRUE);
    }
    template.put("String_Node_Str",LiferayWindowState.POP_UP);
    populatePortletDisplayTemplateViewContext(template,portletRequest,themeDisplay,results,campaignQueryRules);
  }
 else   if (path.equals(CampaignContentDisplayPath.EDIT_QUERY_RULE) || path.equals(CampaignContentDisplayPath.CONFIGURATION)) {
    template.put("String_Node_Str",getSelectableAssetRendererFactories(themeDisplay.getCompanyId()));
    String assetImageDefault=StringPool.BLANK;
    String assetTitleDefault=StringPool.BLANK;
    String assetTypeDefault=StringPool.BLANK;
    if (assetEntryIdDefault > 0) {
      AssetEntry assetEntry=AssetEntryLocalServiceUtil.fetchAssetEntry(assetEntryIdDefault);
      AssetRendererFactory assetRendererFactory=AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(assetEntry.getClassName());
      AssetRenderer assetRenderer=assetRendererFactory.getAssetRenderer(assetEntry.getClassPK());
      assetImageDefault=assetRenderer.getThumbnailPath(portletRequest);
      assetTitleDefault=assetRenderer.getTitle(themeDisplay.getLocale());
      assetTypeDefault=assetRendererFactory.getTypeName(themeDisplay.getLocale(),true);
    }
    List<Campaign> campaigns=_campaignService.getCampaigns(themeDisplay.getSiteGroupIdOrLiveGroupId());
    template.put("String_Node_Str",campaigns);
    template.put("String_Node_Str",assetEntryIdDefault);
    template.put("String_Node_Str",assetImageDefault);
    template.put("String_Node_Str",assetTitleDefault);
    template.put("String_Node_Str",assetTypeDefault);
    template.put("String_Node_Str",contentDefaultValue);
    template.put("String_Node_Str",LiferayWindowState.EXCLUSIVE);
    template.put("String_Node_Str",portletPreferences);
    int[] queryRulesIndexes=GetterUtil.getIntegerValues(portletPreferences.getValues("String_Node_Str",null),new int[]{0});
    template.put("String_Node_Str",queryRulesIndexes);
    template.put("String_Node_Str",staticModels.get(CampaignQueryRuleUtil.class.getName()));
    template.put("String_Node_Str",staticModels.get(UserSegmentContentDisplayUtil.class.getName()));
  }
}