Program: 64278
Project: 64278
Buggy source:
private org.w3c.dom.Element createInlineSchema(){
  SchemaModelProject project=new SchemaModelProject();
  XMLContext context=new XMLContext(project);
  XMLMarshaller marshaller=context.createMarshaller();
  XMLDescriptor descriptor=(XMLDescriptor)project.getClassDescriptor(Schema.class);
  if (descriptor.getNamespaceResolver() == null) {
    descriptor.setNamespaceResolver(new NamespaceResolver());
  }
  descriptor.getNamespaceResolver().put(NS_TNS_PREFIX,serviceNameSpace);
  descriptor.getNamespaceResolver().put(NS_SCHEMA_PREFIX,W3C_XML_SCHEMA_NS_URI);
  if (hasAttachments) {
    descriptor.getNamespaceResolver().put(WSI_SWAREF_PREFIX,WSI_SWAREF_URI);
  }
  Schema schema=new Schema();
  schema.setTargetNamespace(serviceNameSpace);
  schema.setElementFormDefault(true);
  Import parent=new Import();
  parent.setNamespace(importedSchemaNameSpace);
  parent.setSchemaLocation(DBWS_SCHEMA_XML);
  schema.getImports().add(parent);
  if (hasAttachments) {
    Import ref=new Import();
    ref.setNamespace(WSI_SWAREF_URI);
    ref.setSchemaLocation(WSI_SWAREF_XSD_FILE);
    schema.getImports().add(ref);
  }
  boolean requireFaultTypeEmptyResponse=false;
  for (  Operation op : xrServiceModel.getOperationsList()) {
    String opName=op.getName();
    ComplexType requestType=new ComplexType();
    String tableNameAlias=opName.substring(opName.indexOf('_') + 1);
    requestType.setName(opName + REQUEST_SUFFIX + TYPE_SUFFIX);
    Sequence requestSequence=null;
    if (op.getParameters().size() > 0) {
      requestSequence=new Sequence();
      for (      Parameter p : op.getParameters()) {
        Element arg=new Element();
        if (p.isOptional()) {
          arg.setMinOccurs("String_Node_Str");
        }
        arg.setName(p.getName());
        if (THE_INSTANCE_NAME.equals(p.getName())) {
          ComplexType nestedComplexType=new ComplexType();
          Sequence nestedSequence=new Sequence();
          nestedComplexType.setSequence(nestedSequence);
          Element nestedElement=new Element();
          nestedElement.setRef(TARGET_NAMESPACE_PREFIX + "String_Node_Str" + tableNameAlias);
          nestedSequence.addElement(nestedElement);
          arg.setComplexType(nestedComplexType);
        }
 else {
          arg.setName(p.getName());
          if (p.getType().getNamespaceURI().equals(W3C_XML_SCHEMA_NS_URI)) {
            arg.setType(NS_SCHEMA_PREFIX + "String_Node_Str" + p.getType().getLocalPart());
          }
 else           if (p.getType().getNamespaceURI().equals(importedSchemaNameSpace)) {
            arg.setType(TARGET_NAMESPACE_PREFIX + "String_Node_Str" + p.getType().getLocalPart());
          }
 else {
            arg.setType(p.getType().getLocalPart());
          }
        }
        requestSequence.addElement(arg);
      }
      requestType.setSequence(requestSequence);
    }
    schema.addTopLevelComplexTypes(requestType);
    Element requestElement=new Element();
    requestElement.setName(op.getName());
    requestElement.setType(NS_TNS_PREFIX + "String_Node_Str" + requestType.getName());
    schema.addTopLevelElement(requestElement);
    if (op instanceof QueryOperation) {
      QueryOperation q=(QueryOperation)op;
      ComplexType responseType=new ComplexType();
      responseType.setName(op.getName() + RESPONSE_SUFFIX + TYPE_SUFFIX);
      Sequence responseSequence=new Sequence();
      Element result=new Element();
      result.setName("String_Node_Str");
      if (q.isAttachment()) {
        result.setType(WSI_SWAREF_PREFIX + "String_Node_Str" + WSI_SWAREF);
      }
 else       if (q.isSimpleXMLFormat() || q.getResultType().equals(new QName(W3C_XML_SCHEMA_NS_URI,"String_Node_Str"))) {
        ComplexType anyType=new ComplexType();
        Sequence anySequence=new Sequence();
        anySequence.addAny(new Any());
        anyType.setSequence(anySequence);
        result.setComplexType(anyType);
      }
 else {
        if (q.getResultType().getNamespaceURI().equals(W3C_XML_SCHEMA_NS_URI)) {
          result.setType(NS_SCHEMA_PREFIX + "String_Node_Str" + q.getResultType().getLocalPart());
        }
 else {
          ComplexType nestedComplexType=new ComplexType();
          Sequence nestedSequence=new Sequence();
          nestedComplexType.setSequence(nestedSequence);
          Element nestedElement=new Element();
          if (!q.isUserDefined()) {
            nestedElement.setRef(TARGET_NAMESPACE_PREFIX + "String_Node_Str" + tableNameAlias);
          }
 else {
            nestedElement.setRef(TARGET_NAMESPACE_PREFIX + "String_Node_Str" + q.getResultType().getLocalPart());
          }
          nestedElement.setMinOccurs("String_Node_Str");
          if (q.isCollection()) {
            nestedElement.setMaxOccurs("String_Node_Str");
          }
          nestedSequence.addElement(nestedElement);
          result.setComplexType(nestedComplexType);
        }
      }
      responseSequence.addElement(result);
      responseType.setSequence(responseSequence);
      schema.addTopLevelComplexTypes(responseType);
      Element responseElement=new Element();
      responseElement.setName(op.getName() + RESPONSE_SUFFIX);
      responseElement.setType(NS_TNS_PREFIX + "String_Node_Str" + responseType.getName());
      schema.addTopLevelElement(responseElement);
    }
 else {
      requireFaultTypeEmptyResponse=true;
    }
  }
  if (requireFaultTypeEmptyResponse) {
    Element emptyResponseElement=new Element();
    emptyResponseElement.setName(EMPTY_RESPONSE);
    ComplexType emptyResponseComplexType=new ComplexType();
    emptyResponseElement.setComplexType(emptyResponseComplexType);
    schema.addTopLevelElement(emptyResponseElement);
    Element elementFaultType=new Element();
    elementFaultType.setName(FAULT_SUFFIX + TYPE_SUFFIX);
    ComplexType faultComplexType=new ComplexType();
    elementFaultType.setComplexType(faultComplexType);
    Sequence nestedSequence=new Sequence();
    faultComplexType.setSequence(nestedSequence);
    Element faultCodeElement=new Element();
    faultCodeElement.setName("String_Node_Str");
    faultCodeElement.setMinOccurs("String_Node_Str");
    faultCodeElement.setType(NS_SCHEMA_PREFIX + "String_Node_Str");
    nestedSequence.addElement(faultCodeElement);
    Element faultStringElement=new Element();
    faultStringElement.setMinOccurs("String_Node_Str");
    faultStringElement.setName("String_Node_Str");
    faultStringElement.setType(NS_SCHEMA_PREFIX + "String_Node_Str");
    nestedSequence.addElement(faultStringElement);
    schema.addTopLevelElement(elementFaultType);
  }
  return marshaller.objectToXML(schema).getDocumentElement();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private org.w3c.dom.Element createInlineSchema(){
  SchemaModelProject project=new SchemaModelProject();
  XMLContext context=new XMLContext(project);
  XMLMarshaller marshaller=context.createMarshaller();
  XMLDescriptor descriptor=(XMLDescriptor)project.getClassDescriptor(Schema.class);
  if (descriptor.getNamespaceResolver() == null) {
    descriptor.setNamespaceResolver(new NamespaceResolver());
  }
  descriptor.getNamespaceResolver().put(NS_TNS_PREFIX,serviceNameSpace);
  descriptor.getNamespaceResolver().put(NS_SCHEMA_PREFIX,W3C_XML_SCHEMA_NS_URI);
  if (hasAttachments) {
    descriptor.getNamespaceResolver().put(WSI_SWAREF_PREFIX,WSI_SWAREF_URI);
  }
  Schema schema=new Schema();
  schema.setTargetNamespace(serviceNameSpace);
  schema.setElementFormDefault(true);
  Import parent=new Import();
  parent.setNamespace(importedSchemaNameSpace);
  parent.setSchemaLocation(DBWS_SCHEMA_XML);
  schema.getImports().add(parent);
  if (hasAttachments) {
    Import ref=new Import();
    ref.setNamespace(WSI_SWAREF_URI);
    ref.setSchemaLocation(WSI_SWAREF_XSD_FILE);
    schema.getImports().add(ref);
  }
  boolean requireFaultTypeEmptyResponse=false;
  for (  Operation op : xrServiceModel.getOperationsList()) {
    String opName=op.getName();
    ComplexType requestType=new ComplexType();
    String tableNameAlias=opName.substring(opName.indexOf('_') + 1);
    requestType.setName(opName + REQUEST_SUFFIX + TYPE_SUFFIX);
    Sequence requestSequence=null;
    if (op.getParameters().size() > 0) {
      requestSequence=new Sequence();
      for (      Parameter p : op.getParameters()) {
        Element arg=new Element();
        if (p.isOptional()) {
          arg.setMinOccurs("String_Node_Str");
        }
        arg.setName(p.getName());
        if (THE_INSTANCE_NAME.equals(p.getName())) {
          ComplexType nestedComplexType=new ComplexType();
          Sequence nestedSequence=new Sequence();
          nestedComplexType.setSequence(nestedSequence);
          Element nestedElement=new Element();
          nestedElement.setRef(TARGET_NAMESPACE_PREFIX + "String_Node_Str" + tableNameAlias);
          nestedSequence.addElement(nestedElement);
          arg.setComplexType(nestedComplexType);
        }
 else {
          arg.setName(p.getName());
          if (p.getType().getNamespaceURI().equals(W3C_XML_SCHEMA_NS_URI)) {
            arg.setType(NS_SCHEMA_PREFIX + "String_Node_Str" + p.getType().getLocalPart());
          }
 else           if (p.getType().getNamespaceURI().equals(importedSchemaNameSpace)) {
            arg.setType(TARGET_NAMESPACE_PREFIX + "String_Node_Str" + p.getType().getLocalPart());
          }
 else {
            arg.setType(p.getType().getLocalPart());
          }
        }
        requestSequence.addElement(arg);
      }
      requestType.setSequence(requestSequence);
    }
    schema.addTopLevelComplexTypes(requestType);
    Element requestElement=new Element();
    requestElement.setName(op.getName());
    requestElement.setType(NS_TNS_PREFIX + "String_Node_Str" + requestType.getName());
    schema.addTopLevelElement(requestElement);
    if (op instanceof QueryOperation) {
      QueryOperation q=(QueryOperation)op;
      ComplexType responseType=new ComplexType();
      responseType.setName(op.getName() + RESPONSE_SUFFIX + TYPE_SUFFIX);
      Sequence responseSequence=new Sequence();
      Element result=new Element();
      result.setName("String_Node_Str");
      if (q.isAttachment()) {
        result.setType(WSI_SWAREF_PREFIX + "String_Node_Str" + WSI_SWAREF);
      }
 else       if (q.isSimpleXMLFormat() || q.getResultType().equals(new QName(W3C_XML_SCHEMA_NS_URI,"String_Node_Str"))) {
        ComplexType anyType=new ComplexType();
        Sequence anySequence=new Sequence();
        anySequence.addAny(new Any());
        anyType.setSequence(anySequence);
        result.setComplexType(anyType);
      }
 else {
        if (q.getResultType().getNamespaceURI().equals(W3C_XML_SCHEMA_NS_URI)) {
          result.setType(NS_SCHEMA_PREFIX + "String_Node_Str" + q.getResultType().getLocalPart());
        }
 else {
          ComplexType nestedComplexType=new ComplexType();
          Sequence nestedSequence=new Sequence();
          nestedComplexType.setSequence(nestedSequence);
          Element nestedElement=new Element();
          if (!q.isUserDefined()) {
            nestedElement.setRef(TARGET_NAMESPACE_PREFIX + "String_Node_Str" + tableNameAlias);
          }
 else {
            nestedElement.setRef(TARGET_NAMESPACE_PREFIX + "String_Node_Str" + q.getResultType().getLocalPart());
          }
          nestedElement.setMinOccurs("String_Node_Str");
          if (q.isCollection()) {
            nestedElement.setMaxOccurs("String_Node_Str");
          }
          nestedSequence.addElement(nestedElement);
          result.setComplexType(nestedComplexType);
        }
      }
      responseSequence.addElement(result);
      responseType.setSequence(responseSequence);
      schema.addTopLevelComplexTypes(responseType);
      Element responseElement=new Element();
      responseElement.setName(op.getName() + RESPONSE_SUFFIX);
      responseElement.setType(NS_TNS_PREFIX + "String_Node_Str" + responseType.getName());
      schema.addTopLevelElement(responseElement);
    }
 else {
      requireFaultTypeEmptyResponse=true;
    }
  }
  if (requireFaultTypeEmptyResponse) {
    Element emptyResponseElement=new Element();
    emptyResponseElement.setName(EMPTY_RESPONSE);
    ComplexType emptyResponseComplexType=new ComplexType();
    emptyResponseElement.setComplexType(emptyResponseComplexType);
    schema.addTopLevelElement(emptyResponseElement);
    Element elementFaultType=new Element();
    elementFaultType.setName(FAULT_SUFFIX + TYPE_SUFFIX);
    ComplexType faultComplexType=new ComplexType();
    elementFaultType.setComplexType(faultComplexType);
    Sequence nestedSequence=new Sequence();
    faultComplexType.setSequence(nestedSequence);
    Element faultCodeElement=new Element();
    faultCodeElement.setName("String_Node_Str");
    faultCodeElement.setMinOccurs("String_Node_Str");
    faultCodeElement.setType(NS_SCHEMA_PREFIX + "String_Node_Str");
    nestedSequence.addElement(faultCodeElement);
    Element faultStringElement=new Element();
    faultStringElement.setMinOccurs("String_Node_Str");
    faultStringElement.setName("String_Node_Str");
    faultStringElement.setType(NS_SCHEMA_PREFIX + "String_Node_Str");
    nestedSequence.addElement(faultStringElement);
    schema.addTopLevelElement(elementFaultType);
  }
  return marshaller.objectToXML(schema).getDocumentElement();
}