Program: 102316
Project: 102316
Buggy source:
/** 
 * @return
 */
public XSDTypeDefinition getSchemaForSelectedOperation(final int type){
  Model wsdlModel=null;
  XSDTypeDefinition elementDeclaration=null;
  try {
    wsdlModel=importManager.getWSDLModel();
  }
 catch (  ModelGenerationException e) {
    e.printStackTrace();
  }
  XSDSchema[] schemas=wsdlModel.getSchemas();
  Operation selectedOperation=procedureGenerator.getOperation();
  String partElementName=null;
  if (type == REQUEST) {
    partElementName=selectedOperation.getInputMessage().getParts()[0].getTypeName();
    if (partElementName == null) {
      partElementName=selectedOperation.getInputMessage().getParts()[0].getElementName();
    }
  }
 else {
    partElementName=selectedOperation.getOutputMessage().getParts()[0].getTypeName();
    if (partElementName == null) {
      partElementName=selectedOperation.getOutputMessage().getParts()[0].getElementName();
    }
  }
  for (  XSDSchema schema : schemas) {
    xsdSchema=schema;
    EList<XSDTypeDefinition> types=schema.getTypeDefinitions();
    for (    XSDTypeDefinition xsdType : types) {
      String elementName=xsdType.getName();
      if (xsdType.getName().equals(partElementName)) {
        elementDeclaration=xsdType;
        break;
      }
    }
    if (elementDeclaration == null) {
      EList<XSDElementDeclaration> elements=schema.getElementDeclarations();
      for (      XSDElementDeclaration element : elements) {
        String elementName=element.getName();
        if (element.getName().equals(partElementName)) {
          elementDeclaration=element.getTypeDefinition();
          break;
        }
      }
    }
  }
  return elementDeclaration;
}

Fixed version (ground truth):
/** 
 * @return
 */
public XSDTypeDefinition getSchemaForSelectedOperation(final int type){
  Model wsdlModel=null;
  XSDTypeDefinition elementDeclaration=null;
  try {
    wsdlModel=importManager.getWSDLModel();
  }
 catch (  ModelGenerationException e) {
    e.printStackTrace();
  }
  XSDSchema[] schemas=wsdlModel.getSchemas();
  Operation selectedOperation=procedureGenerator.getOperation();
  String partElementName=null;
  if (type == REQUEST) {
    if (selectedOperation.getInputMessage() != null) {
      partElementName=selectedOperation.getInputMessage().getParts()[0].getTypeName();
      if (partElementName == null) {
        partElementName=selectedOperation.getInputMessage().getParts()[0].getElementName();
      }
    }
  }
 else {
    if (selectedOperation.getOutputMessage() != null) {
      partElementName=selectedOperation.getOutputMessage().getParts()[0].getTypeName();
      if (partElementName == null) {
        partElementName=selectedOperation.getOutputMessage().getParts()[0].getElementName();
      }
    }
  }
  for (  XSDSchema schema : schemas) {
    xsdSchema=schema;
    EList<XSDTypeDefinition> types=schema.getTypeDefinitions();
    for (    XSDTypeDefinition xsdType : types) {
      String elementName=xsdType.getName();
      if (elementName.equals(partElementName)) {
        elementDeclaration=xsdType;
        break;
      }
    }
    if (elementDeclaration == null) {
      EList<XSDElementDeclaration> elements=schema.getElementDeclarations();
      for (      XSDElementDeclaration element : elements) {
        String elementName=element.getName();
        if (elementName.equals(partElementName)) {
          elementDeclaration=element.getTypeDefinition();
          break;
        }
      }
    }
  }
  return elementDeclaration;
}