Program: 63923
Project: 63923
Buggy source:
public void writeOROXProjects(OutputStream dbwsOrStream,OutputStream dbwsOxStream){
  Project orProject=dbwsBuilder.getOrProject();
  Project oxProject=dbwsBuilder.getOxProject();
  boolean writeORProject=false;
  if (hasTables() || dbwsBuilder.hasBuildSqlOperations()) {
    writeORProject=true;
  }
 else   if (hasComplexProcedureArgs()) {
    writeORProject=true;
  }
  if (!writeORProject) {
    if (orProject.getQueries().size() > 0) {
      writeORProject=true;
    }
 else     if (orProject.getDescriptors().size() > 0) {
      Collection<ClassDescriptor> descriptors=orProject.getDescriptors().values();
      for (      ClassDescriptor desc : descriptors) {
        if (desc.isObjectRelationalDataTypeDescriptor()) {
          writeORProject=true;
          break;
        }
      }
    }
  }
  if ((writeORProject || !dbwsBuilder.xrServiceModel.getOperations().isEmpty()) && !isNullStream(dbwsOrStream)) {
    XMLContext context=new XMLContext(workbenchXMLProject);
    context.getSession(orProject).getEventManager().addListener(new MissingDescriptorListener());
    XMLEntityMappings mappings=XmlEntityMappingsGenerator.generateXmlEntityMappings(orProject,complextypes,crudOps);
    if (mappings != null) {
      XMLEntityMappingsWriter writer=new XMLEntityMappingsWriter();
      writer.write(mappings,dbwsOrStream);
    }
  }
  if (!isNullStream(dbwsOxStream)) {
    boolean writeOXProject=false;
    if (hasTables() || dbwsBuilder.hasBuildSqlOperations()) {
      writeOXProject=true;
    }
 else     if (hasComplexProcedureArgs()) {
      writeOXProject=true;
    }
    if (!writeOXProject) {
      if (orProject.getQueries().size() > 0) {
        writeOXProject=true;
      }
 else       if (orProject.getDescriptors().size() > 0) {
        Collection<ClassDescriptor> descriptors=orProject.getDescriptors().values();
        for (        ClassDescriptor desc : descriptors) {
          if (desc.isObjectRelationalDataTypeDescriptor()) {
            writeOXProject=true;
            break;
          }
        }
      }
    }
    if (writeOXProject) {
      List<XmlBindings> xmlBindingsList=XmlBindingsGenerator.generateXmlBindings(oxProject.getOrderedDescriptors());
      if (xmlBindingsList.size() > 0) {
        XmlBindingsModel model=new XmlBindingsModel();
        model.setBindingsList(xmlBindingsList);
        try {
          JAXBContext jc=JAXBContext.newInstance(XmlBindingsModel.class);
          Marshaller marshaller=jc.createMarshaller();
          marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,true);
          marshaller.marshal(model,dbwsOxStream);
        }
 catch (        JAXBException jaxbEx) {
          throw new DBWSException(OXM_MARSHAL_EX_MSG,jaxbEx);
        }
      }
    }
  }
  dbwsBuilder.getPackager().closeOrStream(dbwsOrStream);
  dbwsBuilder.getPackager().closeOxStream(dbwsOxStream);
}

Fixed version (ground truth):
public void writeOROXProjects(OutputStream dbwsOrStream,OutputStream dbwsOxStream){
  Project orProject=dbwsBuilder.getOrProject();
  Project oxProject=dbwsBuilder.getOxProject();
  boolean writeORProject=false;
  if (hasTables() || dbwsBuilder.hasBuildSqlOperations()) {
    writeORProject=true;
  }
  if (!writeORProject) {
    if (orProject.getQueries().size() > 0) {
      writeORProject=true;
    }
 else     if (orProject.getDescriptors().size() > 0) {
      Collection<ClassDescriptor> descriptors=orProject.getDescriptors().values();
      for (      ClassDescriptor desc : descriptors) {
        if (desc.isObjectRelationalDataTypeDescriptor()) {
          writeORProject=true;
          break;
        }
      }
    }
  }
  if ((writeORProject || !dbwsBuilder.xrServiceModel.getOperations().isEmpty()) && !isNullStream(dbwsOrStream)) {
    XMLContext context=new XMLContext(workbenchXMLProject);
    context.getSession(orProject).getEventManager().addListener(new MissingDescriptorListener());
    XMLEntityMappings mappings=XmlEntityMappingsGenerator.generateXmlEntityMappings(orProject,complextypes,crudOps);
    if (mappings != null) {
      XMLEntityMappingsWriter writer=new XMLEntityMappingsWriter();
      writer.write(mappings,dbwsOrStream);
    }
  }
  if (!isNullStream(dbwsOxStream)) {
    boolean writeOXProject=false;
    if (hasTables() || dbwsBuilder.hasBuildSqlOperations()) {
      writeOXProject=true;
    }
    if (!writeOXProject) {
      if (orProject.getQueries().size() > 0) {
        writeOXProject=true;
      }
 else       if (orProject.getDescriptors().size() > 0) {
        Collection<ClassDescriptor> descriptors=orProject.getDescriptors().values();
        for (        ClassDescriptor desc : descriptors) {
          if (desc.isObjectRelationalDataTypeDescriptor()) {
            writeOXProject=true;
            break;
          }
        }
      }
    }
    if (writeOXProject) {
      List<XmlBindings> xmlBindingsList=XmlBindingsGenerator.generateXmlBindings(oxProject.getOrderedDescriptors());
      if (xmlBindingsList.size() > 0) {
        XmlBindingsModel model=new XmlBindingsModel();
        model.setBindingsList(xmlBindingsList);
        try {
          JAXBContext jc=JAXBContext.newInstance(XmlBindingsModel.class);
          Marshaller marshaller=jc.createMarshaller();
          marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,true);
          marshaller.marshal(model,dbwsOxStream);
        }
 catch (        JAXBException jaxbEx) {
          throw new DBWSException(OXM_MARSHAL_EX_MSG,jaxbEx);
        }
      }
    }
  }
  dbwsBuilder.getPackager().closeOrStream(dbwsOrStream);
  dbwsBuilder.getPackager().closeOxStream(dbwsOxStream);
}