Program: 64971
Project: 64971
Buggy source:
/** 
 * Build descriptor and mappings for a PL/SQL record argument.  The newly created descriptor will be added to the given OX project.
 */
protected void addToOXProjectForPLSQLRecordArg(DatabaseType dbType,Project oxProject,String recordName,String recordAlias,String targetTypeName,String catalogPattern){
  XMLDescriptor xdesc=(XMLDescriptor)oxProject.getDescriptorForAlias(recordAlias);
  if (xdesc == null) {
    xdesc=buildAndAddNewXMLDescriptor(oxProject,recordAlias,recordName.toLowerCase(),targetTypeName,buildCustomQName(targetTypeName,dbwsBuilder).getNamespaceURI());
  }
  PLSQLRecordType plsqlRecType=(PLSQLRecordType)dbType;
  for (  FieldType fType : plsqlRecType.getFields()) {
    String lFieldName=fType.getFieldName().toLowerCase();
    if (xdesc.getMappingForAttributeName(lFieldName) == null) {
      if (fType.isComposite()) {
        if (fType.getEnclosedType().isPLSQLRecordType()) {
          buildAndAddXMLCompositeObjectMapping(xdesc,lFieldName,(catalogPattern + DOT + fType.getEnclosedType()).toLowerCase());
        }
 else         if (fType.getEnclosedType().isPLSQLCollectionType()) {
          PLSQLCollectionType tableType=(PLSQLCollectionType)fType.getEnclosedType();
          if (tableType.getEnclosedType().isComposite()) {
            buildAndAddXMLCompositeObjectMapping(xdesc,lFieldName,(catalogPattern + DOT + tableType.getTypeName()).toLowerCase() + COLLECTION_WRAPPER_SUFFIX);
          }
 else {
            Class<?> attributeElementClass=String.class;
            XMLDescriptor refDesc=(XMLDescriptor)oxProject.getDescriptorForAlias((catalogPattern + UNDERSCORE + tableType.getTypeName()).toLowerCase());
            if (refDesc != null) {
              attributeElementClass=((XMLCompositeDirectCollectionMapping)refDesc.getMappingForAttributeName(ITEMS_MAPPING_ATTRIBUTE_NAME)).getAttributeElementClass();
            }
            buildAndAddXMLCompositeDirectCollectionMapping(xdesc,lFieldName,lFieldName + SLASH + ITEM_MAPPING_NAME+ SLASH+ TEXT,attributeElementClass);
          }
        }
 else         if (fType.getEnclosedType().isObjectType()) {
          buildAndAddXMLCompositeObjectMapping(xdesc,lFieldName,getGeneratedJavaClassName(fType.getEnclosedType().getTypeName(),dbwsBuilder.getProjectName()));
        }
 else         if (fType.getEnclosedType().isVArrayType()) {
          if (((VArrayType)fType.getEnclosedType()).getEnclosedType().isComposite()) {
            String nestedTypeAlias=((VArrayType)fType.getEnclosedType()).getEnclosedType().getTypeName().toLowerCase();
            String nestedTypeName=getGeneratedJavaClassName(nestedTypeAlias,dbwsBuilder.getProjectName());
            buildAndAddXMLCompositeCollectionMapping(xdesc,lFieldName,lFieldName + SLASH + ITEM_MAPPING_NAME,nestedTypeName);
          }
 else {
            buildAndAddXMLCompositeDirectCollectionMapping(xdesc,lFieldName,lFieldName + SLASH + ITEM_MAPPING_NAME+ SLASH+ TEXT,getAttributeClassForDatabaseType(fType.getEnclosedType()));
          }
        }
 else         if (fType.getEnclosedType().isObjectTableType()) {
          String nestedTypeAlias=((ObjectTableType)fType.getEnclosedType()).getEnclosedType().getTypeName().toLowerCase();
          String nestedTypeName=getGeneratedJavaClassName(nestedTypeAlias,dbwsBuilder.getProjectName());
          buildAndAddXMLCompositeCollectionMapping(xdesc,lFieldName,lFieldName + SLASH + ITEM_MAPPING_NAME,nestedTypeName);
        }
      }
 else {
        addDirectMappingForFieldType(xdesc,lFieldName,fType);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Build descriptor and mappings for a PL/SQL record argument.  The newly created descriptor will be added to the given OX project.
 */
protected void addToOXProjectForPLSQLRecordArg(DatabaseType dbType,Project oxProject,String recordName,String recordAlias,String targetTypeName,String catalogPattern){
  XMLDescriptor xdesc=(XMLDescriptor)oxProject.getDescriptorForAlias(recordAlias);
  if (xdesc == null) {
    xdesc=buildAndAddNewXMLDescriptor(oxProject,recordAlias,recordName.toLowerCase(),targetTypeName,buildCustomQName(targetTypeName,dbwsBuilder).getNamespaceURI());
  }
  PLSQLRecordType plsqlRecType=(PLSQLRecordType)dbType;
  for (  FieldType fType : plsqlRecType.getFields()) {
    String lFieldName=fType.getFieldName().toLowerCase();
    if (xdesc.getMappingForAttributeName(lFieldName) == null) {
      if (fType.isComposite()) {
        if (fType.getEnclosedType().isPLSQLRecordType()) {
          buildAndAddXMLCompositeObjectMapping(xdesc,lFieldName,(catalogPattern + DOT + fType.getEnclosedType()).toLowerCase());
        }
 else         if (fType.getEnclosedType().isPLSQLCollectionType()) {
          PLSQLCollectionType tableType=(PLSQLCollectionType)fType.getEnclosedType();
          if (tableType.getEnclosedType().isComposite()) {
            buildAndAddXMLCompositeObjectMapping(xdesc,lFieldName,(catalogPattern + DOT + tableType.getTypeName()).toLowerCase() + COLLECTION_WRAPPER_SUFFIX);
          }
 else {
            Class<?> attributeElementClass=String.class;
            XMLDescriptor refDesc=(XMLDescriptor)oxProject.getDescriptorForAlias((catalogPattern + UNDERSCORE + tableType.getTypeName()).toLowerCase());
            if (refDesc != null) {
              attributeElementClass=((XMLCompositeDirectCollectionMapping)refDesc.getMappingForAttributeName(ITEMS_MAPPING_ATTRIBUTE_NAME)).getAttributeElementClass();
            }
            buildAndAddXMLCompositeDirectCollectionMapping(xdesc,lFieldName,lFieldName + SLASH + ITEM_MAPPING_NAME+ SLASH+ TEXT,attributeElementClass);
          }
        }
 else         if (fType.getEnclosedType().isObjectType()) {
          buildAndAddXMLCompositeObjectMapping(xdesc,lFieldName,getGeneratedJavaClassName(fType.getEnclosedType().getTypeName(),dbwsBuilder.getProjectName()));
        }
 else         if (fType.getEnclosedType().isVArrayType()) {
          if (((VArrayType)fType.getEnclosedType()).getEnclosedType().isComposite()) {
            String nestedTypeAlias=((VArrayType)fType.getEnclosedType()).getEnclosedType().getTypeName().toLowerCase();
            String nestedTypeName=getGeneratedJavaClassName(nestedTypeAlias,dbwsBuilder.getProjectName());
            buildAndAddXMLCompositeCollectionMapping(xdesc,lFieldName,lFieldName + SLASH + ITEM_MAPPING_NAME,nestedTypeName);
          }
 else {
            buildAndAddXMLCompositeDirectCollectionMapping(xdesc,lFieldName,lFieldName + SLASH + ITEM_MAPPING_NAME+ SLASH+ TEXT,getAttributeClassForDatabaseType(fType.getEnclosedType()));
          }
        }
 else         if (fType.getEnclosedType().isObjectTableType()) {
          ObjectTableType nestedType=(ObjectTableType)fType.getEnclosedType();
          if (nestedType.getEnclosedType().isComposite()) {
            String nestedTypeAlias=nestedType.getEnclosedType().getTypeName().toLowerCase();
            String nestedTypeName=getGeneratedJavaClassName(nestedTypeAlias,dbwsBuilder.getProjectName());
            buildAndAddXMLCompositeCollectionMapping(xdesc,lFieldName,lFieldName + SLASH + ITEM_MAPPING_NAME,nestedTypeName);
          }
 else {
            buildAndAddXMLCompositeDirectCollectionMapping(xdesc,lFieldName,lFieldName + SLASH + TEXT,getAttributeClassForDatabaseType(nestedType));
          }
        }
      }
 else {
        addDirectMappingForFieldType(xdesc,lFieldName,fType);
      }
    }
  }
}