Program: 64988
Project: 64988
Buggy source:
/** 
 * Output metadata properties.
 * @param map
 * @param element
 * @param tagName
 * @return boolean: has the bookmark been output?
 */
public boolean outputMetadataProperty(HashMap propertyMap,Object element,String tagName){
  if (propertyMap == null) {
    return false;
  }
  boolean iidOutput=false;
  boolean bookmarkOutput=false;
  boolean elementTypeOutput=false;
  boolean addToIIDList=false;
  InstanceID iid=null;
  String bookmark=null;
  String elementType=null;
  Iterator ite=propertyMap.entrySet().iterator();
  while (ite.hasNext()) {
    Map.Entry entry=(Map.Entry)ite.next();
    Object keyObj=entry.getKey();
    Object valueObj=entry.getValue();
    if (keyObj instanceof String) {
      String keyStr=(String)keyObj;
      if (keyStr == IMetadataFilter.KEY_OUTPUT_IID) {
        Object genBy=null;
        if (element instanceof IContent) {
          iid=((IContent)element).getInstanceID();
          genBy=((IContent)element).getGenerateBy();
        }
 else         if (element instanceof IColumn) {
          iid=((IColumn)element).getInstanceID();
          genBy=((IColumn)element).getGenerateBy();
        }
        if (iid != null) {
          if ((genBy instanceof TableItemDesign) || (genBy instanceof ListItemDesign) || (genBy instanceof ExtendedItemDesign)) {
            writer.attribute(attrIID,iid.toUniqueString());
          }
 else {
            writer.attribute(attrIID,iid.toString());
          }
          iidOutput=true;
        }
      }
 else       if (keyStr == IMetadataFilter.KEY_OUTPUT_BOOKMARK) {
        if (element instanceof IContent) {
          IContent content=(IContent)element;
          bookmark=content.getBookmark();
          if (bookmark == null) {
            bookmark=idGenerator.generateUniqueID();
            content.setBookmark(bookmark);
          }
          htmlReportEmitter.outputBookmark(writer,tagName,htmlIDNamespace,bookmark);
          bookmarkOutput=true;
        }
      }
 else       if (keyStr == IMetadataFilter.KEY_ATTR_ELEMENT_TYPE) {
        if (valueObj == null) {
          continue;
        }
        elementType=(String)valueObj;
        writer.attribute(attrElementType,elementType);
        elementTypeOutput=true;
      }
 else       if (keyStr == IMetadataFilter.KEY_ADD_INTO_IID_LIST) {
        addToIIDList=true;
      }
 else       if (keyStr.equalsIgnoreCase(IMetadataFilter.KEY_ATTR_TYPE)) {
        if (valueObj != null) {
          writer.attribute(attrType,(String)valueObj);
        }
      }
 else       if (keyStr == IMetadataFilter.KEY_ATTR_ROW_TYPE) {
        if (valueObj != null) {
          writer.attribute(attrRowType,(String)valueObj);
        }
      }
 else       if (keyStr == IMetadataFilter.KEY_OUTPUT_GOURP_ID) {
        if (element instanceof IRowContent) {
          String groupId=((IRowContent)element).getGroupId();
          if (groupId != null) {
            writer.attribute(HTMLTags.ATTR_GOURP_ID,groupId);
          }
        }
      }
 else       if (keyStr == IMetadataFilter.KEY_OUTPUT_RAW_DATA) {
        if (element instanceof IDataContent) {
          Object value=((IDataContent)element).getValue();
          if (value != null) {
            String rawData=null;
            try {
              rawData=DataTypeUtil.toLocaleNeutralString(value);
            }
 catch (            BirtException e) {
            }
            if (rawData == null) {
              rawData=value.toString();
            }
            writer.attributeAllowEmpty(HTMLTags.ATTR_RAW_DATA,rawData);
          }
        }
      }
 else {
        if (valueObj != null) {
          if (keyStr.length() > 0) {
            if (attrNamePrefix != null) {
              writer.attribute(attrNamePrefix + keyStr,valueObj.toString());
            }
 else {
              writer.attribute(keyStr,valueObj.toString());
            }
          }
        }
      }
    }
  }
  if (addToIIDList && iidOutput && bookmarkOutput&& elementTypeOutput) {
    exportElementID(bookmark,elementType,iid.getComponentID());
  }
  return bookmarkOutput;
}

Fixed version (ground truth):
/** 
 * Output metadata properties.
 * @param map
 * @param element
 * @param tagName
 * @return boolean: has the bookmark been output?
 */
public boolean outputMetadataProperty(HashMap propertyMap,Object element,String tagName){
  if (propertyMap == null) {
    return false;
  }
  boolean iidOutput=false;
  boolean bookmarkOutput=false;
  boolean elementTypeOutput=false;
  boolean addToIIDList=false;
  InstanceID iid=null;
  String bookmark=null;
  String elementType=null;
  Iterator ite=propertyMap.entrySet().iterator();
  while (ite.hasNext()) {
    Map.Entry entry=(Map.Entry)ite.next();
    Object keyObj=entry.getKey();
    Object valueObj=entry.getValue();
    if (keyObj instanceof String) {
      String keyStr=(String)keyObj;
      if (keyStr == IMetadataFilter.KEY_OUTPUT_IID) {
        Object genBy=null;
        if (element instanceof IContent) {
          iid=((IContent)element).getInstanceID();
          genBy=((IContent)element).getGenerateBy();
        }
 else         if (element instanceof IColumn) {
          iid=((IColumn)element).getInstanceID();
          genBy=((IColumn)element).getGenerateBy();
        }
        if (iid != null) {
          if ((genBy instanceof TableItemDesign) || (genBy instanceof ListItemDesign) || (genBy instanceof ExtendedItemDesign)) {
            writer.attribute(attrIID,iid.toUniqueString());
          }
 else {
            writer.attribute(attrIID,iid.toString());
          }
          iidOutput=true;
        }
      }
 else       if (keyStr == IMetadataFilter.KEY_OUTPUT_BOOKMARK) {
        if (element instanceof IContent) {
          IContent content=(IContent)element;
          bookmark=content.getBookmark();
          if (bookmark == null) {
            bookmark=idGenerator.generateUniqueID();
            content.setBookmark(bookmark);
          }
          htmlReportEmitter.outputBookmark(writer,tagName,htmlIDNamespace,bookmark);
          bookmarkOutput=true;
        }
      }
 else       if (keyStr == IMetadataFilter.KEY_ATTR_ELEMENT_TYPE) {
        if (valueObj == null) {
          continue;
        }
        elementType=(String)valueObj;
        writer.attribute(attrElementType,elementType);
        elementTypeOutput=true;
      }
 else       if (keyStr == IMetadataFilter.KEY_ADD_INTO_IID_LIST) {
        addToIIDList=true;
      }
 else       if (keyStr.equalsIgnoreCase(IMetadataFilter.KEY_ATTR_TYPE)) {
        if (valueObj != null) {
          writer.attribute(attrType,(String)valueObj);
        }
      }
 else       if (keyStr == IMetadataFilter.KEY_ATTR_ROW_TYPE) {
        if (valueObj != null) {
          writer.attribute(attrRowType,(String)valueObj);
        }
      }
 else       if (keyStr == IMetadataFilter.KEY_OUTPUT_GOURP_ID) {
        if (element instanceof IRowContent) {
          String groupId=((IRowContent)element).getGroupId();
          if (groupId != null) {
            writer.attribute(HTMLTags.ATTR_GOURP_ID,groupId);
          }
        }
      }
 else       if (keyStr == IMetadataFilter.KEY_OUTPUT_RAW_DATA) {
        if (element instanceof IDataContent) {
          Object value=((IDataContent)element).getValue();
          if (value != null) {
            String rawData=null;
            try {
              rawData=DataTypeUtil.toLocaleNeutralString(value,TimeZone.getTimeZone("String_Node_Str"));
            }
 catch (            BirtException e) {
            }
            if (rawData == null) {
              rawData=value.toString();
            }
            writer.attributeAllowEmpty(HTMLTags.ATTR_RAW_DATA,rawData);
          }
        }
      }
 else {
        if (valueObj != null) {
          if (keyStr.length() > 0) {
            if (attrNamePrefix != null) {
              writer.attribute(attrNamePrefix + keyStr,valueObj.toString());
            }
 else {
              writer.attribute(keyStr,valueObj.toString());
            }
          }
        }
      }
    }
  }
  if (addToIIDList && iidOutput && bookmarkOutput&& elementTypeOutput) {
    exportElementID(bookmark,elementType,iid.getComponentID());
  }
  return bookmarkOutput;
}