Program: 64429
Project: 64429
Buggy source:
private Class generateWrapperClassAndDescriptor(TypeInfo type,QName next,ElementDeclaration nextElement,String nextClassName,String attributeTypeName){
  String namespaceUri=null;
  if (next != null) {
    namespaceUri=next.getNamespaceURI();
    if (namespaceUri == null || namespaceUri.equals(XMLProcessor.DEFAULT)) {
      namespaceUri="String_Node_Str";
    }
  }
  TypeMappingInfo tmi=nextElement.getTypeMappingInfo();
  Class generatedClass=null;
  JaxbClassLoader loader=getJaxbClassLoader();
  if (tmi != null) {
    generatedClass=CompilerHelper.getExisitingGeneratedClass(tmi,typeMappingInfoToGeneratedClasses,typeMappingInfoToAdapterClasses,helper.getClassLoader());
    if (generatedClass == null) {
      generatedClass=this.generateWrapperClass(loader.nextAvailableGeneratedClassName(),attributeTypeName,nextElement.isList(),next);
    }
    typeMappingInfoToGeneratedClasses.put(tmi,generatedClass);
  }
 else {
    generatedClass=this.generateWrapperClass(loader.nextAvailableGeneratedClassName(),attributeTypeName,nextElement.isList(),next);
  }
  this.qNamesToGeneratedClasses.put(next,generatedClass);
  try {
    Class declaredClass=PrivilegedAccessHelper.getClassForName(nextClassName,false,helper.getClassLoader());
    this.qNamesToDeclaredClasses.put(next,declaredClass);
  }
 catch (  Exception e) {
  }
  Descriptor desc=(Descriptor)project.getDescriptor(generatedClass);
  if (desc == null) {
    desc=new XMLDescriptor();
    desc.setJavaClass(generatedClass);
    if (nextElement.isList()) {
      DirectCollectionMapping mapping=new XMLCompositeDirectCollectionMapping();
      mapping.setAttributeName("String_Node_Str");
      mapping.setXPath("String_Node_Str");
      mapping.setUsesSingleNode(true);
      mapping.setReuseContainer(true);
      if (type != null && type.isEnumerationType()) {
        mapping.setValueConverter(buildJAXBEnumTypeConverter(mapping,(EnumTypeInfo)type));
      }
 else {
        try {
          Class fieldElementClass=PrivilegedAccessHelper.getClassForName(nextClassName,false,helper.getClassLoader());
          mapping.setFieldElementClass(fieldElementClass);
        }
 catch (        ClassNotFoundException e) {
        }
      }
      if (nextClassName.equals("String_Node_Str") || nextClassName.equals("String_Node_Str")) {
        ((Field)mapping.getField()).setSchemaType(XMLConstants.BASE_64_BINARY_QNAME);
      }
 else       if (nextClassName.equals("String_Node_Str")) {
        ((Field)mapping.getField()).setSchemaType(XMLConstants.QNAME_QNAME);
      }
      desc.addMapping((CoreMapping)mapping);
    }
 else {
      if (nextElement.getJavaTypeName().equals(OBJECT_CLASS_NAME)) {
        CompositeObjectMapping mapping=new XMLCompositeObjectMapping();
        mapping.setAttributeName("String_Node_Str");
        mapping.setSetMethodName("String_Node_Str");
        mapping.setGetMethodName("String_Node_Str");
        mapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT);
        mapping.setXPath("String_Node_Str");
        ((Field)mapping.getField()).setIsTypedTextField(true);
        ((Field)mapping.getField()).setSchemaType(XMLConstants.ANY_TYPE_QNAME);
        desc.addMapping((CoreMapping)mapping);
      }
 else       if (isBinaryData(nextElement.getJavaType())) {
        BinaryDataMapping mapping=new XMLBinaryDataMapping();
        mapping.setAttributeName("String_Node_Str");
        mapping.setXPath("String_Node_Str");
        ((Field)mapping.getField()).setSchemaType(XMLConstants.BASE_64_BINARY_QNAME);
        mapping.setSetMethodName("String_Node_Str");
        mapping.setGetMethodName("String_Node_Str");
        mapping.getNullPolicy().setNullRepresentedByXsiNil(true);
        mapping.getNullPolicy().setNullRepresentedByEmptyNode(false);
        Class attributeClassification=org.eclipse.persistence.internal.helper.Helper.getClassFromClasseName(attributeTypeName,getClass().getClassLoader());
        mapping.setAttributeClassification(attributeClassification);
        mapping.setShouldInlineBinaryData(false);
        if (nextElement.getTypeMappingInfo() != null) {
          mapping.setSwaRef(nextElement.isXmlAttachmentRef());
          mapping.setMimeType(nextElement.getXmlMimeType());
        }
        desc.addMapping((CoreMapping)mapping);
      }
 else {
        DirectMapping mapping=new XMLDirectMapping();
        mapping.setNullValueMarshalled(true);
        mapping.setAttributeName("String_Node_Str");
        mapping.setXPath("String_Node_Str");
        mapping.setSetMethodName("String_Node_Str");
        mapping.setGetMethodName("String_Node_Str");
        if (nextElement.getDefaultValue() != null) {
          mapping.setNullValue(nextElement.getDefaultValue());
          mapping.getNullPolicy().setNullRepresentedByXsiNil(true);
        }
        if (helper.isBuiltInJavaType(nextElement.getJavaType())) {
          Class attributeClassification=null;
          if (nextElement.getJavaType().isPrimitive()) {
            attributeClassification=XMLConversionManager.getDefaultManager().convertClassNameToClass(attributeTypeName);
          }
 else {
            attributeClassification=org.eclipse.persistence.internal.helper.Helper.getClassFromClasseName(attributeTypeName,getClass().getClassLoader());
          }
          mapping.setAttributeClassification(attributeClassification);
        }
        IsSetNullPolicy nullPolicy=new IsSetNullPolicy("String_Node_Str",false,true,XMLNullRepresentationType.ABSENT_NODE);
        mapping.setNullPolicy(nullPolicy);
        if (type != null && type.isEnumerationType()) {
          mapping.setConverter(buildJAXBEnumTypeConverter(mapping,(EnumTypeInfo)type));
        }
        if (nextClassName.equals("String_Node_Str") || nextClassName.equals("String_Node_Str")) {
          ((Field)mapping.getField()).setSchemaType(XMLConstants.BASE_64_BINARY_QNAME);
        }
 else         if (nextClassName.equals("String_Node_Str")) {
          ((Field)mapping.getField()).setSchemaType(XMLConstants.QNAME_QNAME);
        }
        if (nextElement.getJavaTypeAdapterClass() != null) {
          mapping.setConverter(new XMLJavaTypeConverter(nextElement.getJavaTypeAdapterClass()));
        }
        desc.addMapping((CoreMapping)mapping);
      }
    }
    if (next != null) {
      NamespaceInfo info=getNamespaceInfoForURI(namespaceUri);
      if (info != null) {
        NamespaceResolver resolver=info.getNamespaceResolverForDescriptor();
        String prefix=null;
        if (namespaceUri != XMLConstants.EMPTY_STRING) {
          prefix=resolver.resolveNamespaceURI(namespaceUri);
          if (prefix == null) {
            prefix=getPrefixForNamespace(namespaceUri,resolver,null);
          }
        }
        desc.setNamespaceResolver(resolver);
        if (nextElement.isXmlRootElement()) {
          desc.setDefaultRootElement(getQualifiedString(prefix,next.getLocalPart()));
        }
 else {
          desc.setDefaultRootElement("String_Node_Str");
          desc.addRootElement(getQualifiedString(prefix,next.getLocalPart()));
        }
      }
 else {
        if (namespaceUri.equals("String_Node_Str")) {
          desc.setDefaultRootElement(next.getLocalPart());
        }
 else {
          NamespaceResolver resolver=new NamespaceResolver();
          String prefix=getPrefixForNamespace(namespaceUri,resolver,null);
          desc.setNamespaceResolver(resolver);
          if (nextElement.isXmlRootElement()) {
            desc.setDefaultRootElement(getQualifiedString(prefix,next.getLocalPart()));
          }
 else {
            desc.setDefaultRootElement("String_Node_Str");
            desc.addRootElement(getQualifiedString(prefix,next.getLocalPart()));
          }
        }
      }
    }
    project.addDescriptor((CoreDescriptor)desc);
  }
  return generatedClass;
}

Fixed version (ground truth):
private Class generateWrapperClassAndDescriptor(TypeInfo type,QName next,ElementDeclaration nextElement,String nextClassName,String attributeTypeName){
  String namespaceUri=null;
  if (next != null) {
    namespaceUri=next.getNamespaceURI();
    if (namespaceUri == null || namespaceUri.equals(XMLProcessor.DEFAULT)) {
      namespaceUri="String_Node_Str";
    }
  }
  TypeMappingInfo tmi=nextElement.getTypeMappingInfo();
  Class generatedClass=null;
  JaxbClassLoader loader=getJaxbClassLoader();
  if (tmi != null) {
    generatedClass=CompilerHelper.getExisitingGeneratedClass(tmi,typeMappingInfoToGeneratedClasses,typeMappingInfoToAdapterClasses,helper.getClassLoader());
    if (generatedClass == null) {
      generatedClass=this.generateWrapperClass(loader.nextAvailableGeneratedClassName(),attributeTypeName,nextElement.isList(),next);
    }
    typeMappingInfoToGeneratedClasses.put(tmi,generatedClass);
  }
 else {
    generatedClass=this.generateWrapperClass(loader.nextAvailableGeneratedClassName(),attributeTypeName,nextElement.isList(),next);
  }
  this.qNamesToGeneratedClasses.put(next,generatedClass);
  try {
    Class declaredClass=PrivilegedAccessHelper.getClassForName(nextClassName,false,helper.getClassLoader());
    this.qNamesToDeclaredClasses.put(next,declaredClass);
  }
 catch (  Exception e) {
  }
  Descriptor desc=(Descriptor)project.getDescriptor(generatedClass);
  if (desc == null) {
    desc=new XMLDescriptor();
    desc.setJavaClass(generatedClass);
    if (nextElement.isList()) {
      DirectCollectionMapping mapping=new XMLCompositeDirectCollectionMapping();
      mapping.setAttributeName("String_Node_Str");
      mapping.setXPath("String_Node_Str");
      mapping.setUsesSingleNode(true);
      mapping.setReuseContainer(true);
      if (type != null && type.isEnumerationType()) {
        mapping.setValueConverter(buildJAXBEnumTypeConverter(mapping,(EnumTypeInfo)type));
      }
 else {
        try {
          Class fieldElementClass=PrivilegedAccessHelper.getClassForName(nextClassName,false,helper.getClassLoader());
          mapping.setFieldElementClass(fieldElementClass);
        }
 catch (        ClassNotFoundException e) {
        }
      }
      if (nextClassName.equals("String_Node_Str") || nextClassName.equals("String_Node_Str")) {
        ((Field)mapping.getField()).setSchemaType(XMLConstants.BASE_64_BINARY_QNAME);
      }
 else       if (nextClassName.equals("String_Node_Str")) {
        ((Field)mapping.getField()).setSchemaType(XMLConstants.QNAME_QNAME);
      }
      desc.addMapping((CoreMapping)mapping);
    }
 else {
      if (nextElement.getJavaTypeName().equals(OBJECT_CLASS_NAME)) {
        CompositeObjectMapping mapping=new XMLCompositeObjectMapping();
        mapping.setAttributeName("String_Node_Str");
        mapping.setSetMethodName("String_Node_Str");
        mapping.setGetMethodName("String_Node_Str");
        mapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT);
        mapping.setXPath("String_Node_Str");
        ((Field)mapping.getField()).setIsTypedTextField(true);
        ((Field)mapping.getField()).setSchemaType(XMLConstants.ANY_TYPE_QNAME);
        desc.addMapping((CoreMapping)mapping);
      }
 else       if (isBinaryData(nextElement.getJavaType())) {
        BinaryDataMapping mapping=new XMLBinaryDataMapping();
        mapping.setAttributeName("String_Node_Str");
        mapping.setXPath("String_Node_Str");
        ((Field)mapping.getField()).setSchemaType(XMLConstants.BASE_64_BINARY_QNAME);
        mapping.setSetMethodName("String_Node_Str");
        mapping.setGetMethodName("String_Node_Str");
        mapping.getNullPolicy().setNullRepresentedByXsiNil(true);
        mapping.getNullPolicy().setNullRepresentedByEmptyNode(false);
        Class attributeClassification=org.eclipse.persistence.internal.helper.Helper.getClassFromClasseName(attributeTypeName,getClass().getClassLoader());
        mapping.setAttributeClassification(attributeClassification);
        mapping.setShouldInlineBinaryData(false);
        if (nextElement.getTypeMappingInfo() != null) {
          mapping.setSwaRef(nextElement.isXmlAttachmentRef());
          mapping.setMimeType(nextElement.getXmlMimeType());
        }
        desc.addMapping((CoreMapping)mapping);
      }
 else {
        DirectMapping mapping=new XMLDirectMapping();
        mapping.setNullValueMarshalled(true);
        mapping.setAttributeName("String_Node_Str");
        mapping.setXPath("String_Node_Str");
        mapping.setSetMethodName("String_Node_Str");
        mapping.setGetMethodName("String_Node_Str");
        if (nextElement.getDefaultValue() != null) {
          mapping.setNullValue(nextElement.getDefaultValue());
          mapping.getNullPolicy().setNullRepresentedByXsiNil(true);
        }
        if (helper.isBuiltInJavaType(nextElement.getJavaType())) {
          Class attributeClassification=null;
          if (nextElement.getJavaType().isPrimitive()) {
            attributeClassification=XMLConversionManager.getDefaultManager().convertClassNameToClass(attributeTypeName);
          }
 else {
            attributeClassification=org.eclipse.persistence.internal.helper.Helper.getClassFromClasseName(attributeTypeName,getClass().getClassLoader());
          }
          mapping.setAttributeClassification(attributeClassification);
        }
        IsSetNullPolicy nullPolicy=new IsSetNullPolicy("String_Node_Str",false,true,XMLNullRepresentationType.ABSENT_NODE);
        mapping.setNullPolicy(nullPolicy);
        if (type != null && type.isEnumerationType()) {
          mapping.setConverter(buildJAXBEnumTypeConverter(mapping,(EnumTypeInfo)type));
        }
        if (nextClassName.equals("String_Node_Str") || nextClassName.equals("String_Node_Str")) {
          ((Field)mapping.getField()).setSchemaType(XMLConstants.BASE_64_BINARY_QNAME);
        }
 else         if (nextClassName.equals("String_Node_Str")) {
          ((Field)mapping.getField()).setSchemaType(XMLConstants.QNAME_QNAME);
        }
        if (nextElement.getJavaTypeAdapterClass() != null) {
          mapping.setConverter(new XMLJavaTypeConverter(nextElement.getJavaTypeAdapterClass()));
        }
        desc.addMapping((CoreMapping)mapping);
      }
    }
    if (next != null) {
      NamespaceInfo info=getNamespaceInfoForURI(namespaceUri);
      if (info != null) {
        NamespaceResolver resolver=info.getNamespaceResolverForDescriptor();
        String prefix=null;
        if (namespaceUri != XMLConstants.EMPTY_STRING) {
          prefix=resolver.resolveNamespaceURI(namespaceUri);
          if (prefix == null) {
            prefix=getPrefixForNamespace(namespaceUri,resolver,null);
          }
        }
        desc.setNamespaceResolver(resolver);
        if (nextElement.isXmlRootElement()) {
          desc.setDefaultRootElement(getQualifiedString(prefix,next.getLocalPart()));
        }
 else {
          desc.setDefaultRootElement("String_Node_Str");
          desc.addRootElement(getQualifiedString(prefix,next.getLocalPart()));
        }
      }
 else {
        if (namespaceUri.equals("String_Node_Str")) {
          desc.setDefaultRootElement(next.getLocalPart());
        }
 else {
          NamespaceResolver resolver=new org.eclipse.persistence.oxm.NamespaceResolver();
          String prefix=getPrefixForNamespace(namespaceUri,resolver,null);
          desc.setNamespaceResolver(resolver);
          if (nextElement.isXmlRootElement()) {
            desc.setDefaultRootElement(getQualifiedString(prefix,next.getLocalPart()));
          }
 else {
            desc.setDefaultRootElement("String_Node_Str");
            desc.addRootElement(getQualifiedString(prefix,next.getLocalPart()));
          }
        }
      }
    }
    project.addDescriptor((CoreDescriptor)desc);
  }
  return generatedClass;
}