Program: 128270
Project: 128270
Buggy source:
private void addComplexTypeDetails(XSDSchema xsdSchema,ATreeNode node,XSDTypeDefinition xsdTypeDefinition,String prefix,String namespace,String currentPath) throws OdaException, IllegalAccessException, InvocationTargetException {
  String prefixToUse=prefix;
  if (namespace != null && !namespaceToPrefix.containsKey(namespace)) {
    if (isEnableGeneratePrefix() && (prefix == null || prefix.isEmpty())) {
      prefixToUse="String_Node_Str" + prefixNumberGenerated;
      prefixNumberGenerated++;
    }
    if (namespaceToPrefix.containsValue(prefix)) {
      prefixToUse=prefixToUse + prefixNumberGenerated;
      prefixNumberGenerated++;
    }
    if (prefixToUse != null && !prefixToUse.isEmpty()) {
      namespaceToPrefix.put(namespace,prefixToUse);
    }
  }
  XSDComplexTypeDefinition xsdComplexTypeDefinition=(XSDComplexTypeDefinition)xsdTypeDefinition;
  if (xsdComplexTypeDefinition.getContentType() instanceof XSDParticle) {
    addParticleDetail(xsdSchema,(XSDParticle)xsdComplexTypeDefinition.getContentType(),node,currentPath);
  }
  for (Iterator attributeUses=xsdComplexTypeDefinition.getAttributeUses().iterator(); attributeUses.hasNext(); ) {
    XSDAttributeUse xsdAttributeUse=(XSDAttributeUse)attributeUses.next();
    XSDAttributeDeclaration xsdAttributeDeclaration=xsdAttributeUse.getAttributeDeclaration();
    String attributeDeclarationName=xsdAttributeDeclaration.getName();
    ATreeNode childNode=new ATreeNode();
    childNode.setValue(attributeDeclarationName);
    childNode.setType(ATreeNode.ATTRIBUTE_TYPE);
    String dataType=xsdAttributeDeclaration.getTypeDefinition().getQName();
    if (xsdAttributeDeclaration.getTypeDefinition().getBaseType() != null) {
      dataType=xsdAttributeDeclaration.getTypeDefinition().getBaseType().getQName();
    }
    if (dataType != null && dataType.length() > 0) {
      childNode.setDataType(dataType);
    }
    node.addChild(childNode);
  }
}

Fixed version (ground truth):
private void addComplexTypeDetails(XSDSchema xsdSchema,ATreeNode node,XSDTypeDefinition xsdTypeDefinition,String prefix,String namespace,String currentPath) throws OdaException, IllegalAccessException, InvocationTargetException {
  String prefixToUse=prefix;
  if (namespace != null && !namespaceToPrefix.containsKey(namespace)) {
    if (isEnableGeneratePrefix() && (prefix == null || prefix.isEmpty())) {
      prefixToUse="String_Node_Str" + prefixNumberGenerated;
      prefixNumberGenerated++;
    }
    if (namespaceToPrefix.containsValue(prefix)) {
      prefixToUse=prefixToUse + prefixNumberGenerated;
      prefixNumberGenerated++;
    }
    if (prefixToUse != null && !prefixToUse.isEmpty()) {
      namespaceToPrefix.put(namespace,prefixToUse);
    }
  }
  XSDComplexTypeDefinition xsdComplexTypeDefinition=(XSDComplexTypeDefinition)xsdTypeDefinition;
  if (xsdComplexTypeDefinition.getContentType() instanceof XSDParticle) {
    addParticleDetail(xsdSchema,(XSDParticle)xsdComplexTypeDefinition.getContentType(),node,currentPath);
  }
  for (  Object element : xsdComplexTypeDefinition.getAttributeUses()) {
    XSDAttributeUse xsdAttributeUse=(XSDAttributeUse)element;
    XSDAttributeDeclaration xsdAttributeDeclaration=xsdAttributeUse.getAttributeDeclaration();
    String attributeDeclarationName=xsdAttributeDeclaration.getName();
    ATreeNode childNode=new ATreeNode();
    childNode.setValue(attributeDeclarationName);
    childNode.setType(ATreeNode.ATTRIBUTE_TYPE);
    String dataType=xsdAttributeDeclaration.getTypeDefinition().getQName();
    if (xsdAttributeDeclaration.getTypeDefinition().getBaseType() != null) {
      dataType=xsdAttributeDeclaration.getTypeDefinition().getBaseType().getQName();
    }
    if (dataType != null && dataType.length() > 0) {
      childNode.setDataType(dataType);
    }
    node.addChild(childNode);
  }
}