Program: 34719
Project: 34719
Buggy source:
/** 
 * This test ensures that the OpenAPI document always reflects the correct host/port
 * @throws Exception s
 */
@Test public void testHostPort() throws Exception {
  String openapi=OpenAPIConnection.openAPIDocsConnection(server,false).download();
  JsonNode openapiNode=OpenAPITestUtil.readYamlTree(openapi);
  OpenAPITestUtil.checkServer(openapiNode,OpenAPITestUtil.getServerURLs(server,server.getHttpDefaultPort(),server.getHttpDefaultSecurePort()));
  openapi=OpenAPIConnection.openAPIDocsConnection(server,true).download();
  openapiNode=OpenAPITestUtil.readYamlTree(openapi);
  OpenAPITestUtil.checkServer(openapiNode,OpenAPITestUtil.getServerURLs(server,server.getHttpDefaultPort(),server.getHttpDefaultSecurePort()));
  OpenAPITestUtil.changeServerPorts(server,server.getHttpSecondaryPort(),server.getHttpSecondarySecurePort());
  openapi=OpenAPIConnection.openAPIDocsConnection(server,false).port(server.getHttpSecondaryPort()).download();
  openapiNode=OpenAPITestUtil.readYamlTree(openapi);
  OpenAPITestUtil.checkServer(openapiNode,OpenAPITestUtil.getServerURLs(server,server.getHttpSecondaryPort(),server.getHttpSecondarySecurePort()));
  openapi=OpenAPIConnection.openAPIDocsConnection(server,true).port(server.getHttpSecondarySecurePort()).download();
  openapiNode=OpenAPITestUtil.readYamlTree(openapi);
  OpenAPITestUtil.checkServer(openapiNode,OpenAPITestUtil.getServerURLs(server,server.getHttpSecondaryPort(),server.getHttpSecondarySecurePort()));
  OpenAPITestUtil.changeServerPorts(server,-1,server.getHttpDefaultSecurePort());
  openapi=OpenAPIConnection.openAPIDocsConnection(server,true).download();
  openapiNode=OpenAPITestUtil.readYamlTree(openapi);
  OpenAPITestUtil.checkServer(openapiNode,OpenAPITestUtil.getServerURLs(server,-1,server.getHttpDefaultSecurePort()));
  OpenAPITestUtil.changeServerPorts(server,server.getHttpDefaultPort(),-1);
  openapi=OpenAPIConnection.openAPIDocsConnection(server,false).download();
  openapiNode=OpenAPITestUtil.readYamlTree(openapi);
  OpenAPITestUtil.checkServer(openapiNode,OpenAPITestUtil.getServerURLs(server,server.getHttpDefaultPort(),-1));
}

Fixed version (ground truth):
/** 
 * This test ensures that the OpenAPI document always reflects the correct host/port
 * @throws Exception s
 */
@Test public void testHostPort() throws Exception {
  String openapi=OpenAPIConnection.openAPIDocsConnection(server,false).download();
  JsonNode openapiNode=OpenAPITestUtil.readYamlTree(openapi);
  OpenAPITestUtil.checkServer(openapiNode,OpenAPITestUtil.getServerURLs(server,server.getHttpDefaultPort(),server.getHttpDefaultSecurePort()));
  openapi=OpenAPIConnection.openAPIDocsConnection(server,true).download();
  openapiNode=OpenAPITestUtil.readYamlTree(openapi);
  OpenAPITestUtil.checkServer(openapiNode,OpenAPITestUtil.getServerURLs(server,server.getHttpDefaultPort(),server.getHttpDefaultSecurePort()));
  OpenAPITestUtil.setMarkToEndOfAllLogs(server);
  OpenAPITestUtil.changeServerPorts(server,server.getHttpSecondaryPort(),server.getHttpSecondarySecurePort());
  openapi=OpenAPIConnection.openAPIDocsConnection(server,false).port(server.getHttpSecondaryPort()).download();
  openapiNode=OpenAPITestUtil.readYamlTree(openapi);
  OpenAPITestUtil.checkServer(openapiNode,OpenAPITestUtil.getServerURLs(server,server.getHttpSecondaryPort(),server.getHttpSecondarySecurePort()));
  openapi=OpenAPIConnection.openAPIDocsConnection(server,true).port(server.getHttpSecondarySecurePort()).download();
  openapiNode=OpenAPITestUtil.readYamlTree(openapi);
  OpenAPITestUtil.checkServer(openapiNode,OpenAPITestUtil.getServerURLs(server,server.getHttpSecondaryPort(),server.getHttpSecondarySecurePort()));
  OpenAPITestUtil.setMarkToEndOfAllLogs(server);
  OpenAPITestUtil.changeServerPorts(server,-1,server.getHttpDefaultSecurePort());
  openapi=OpenAPIConnection.openAPIDocsConnection(server,true).download();
  openapiNode=OpenAPITestUtil.readYamlTree(openapi);
  OpenAPITestUtil.checkServer(openapiNode,OpenAPITestUtil.getServerURLs(server,-1,server.getHttpDefaultSecurePort()));
  OpenAPITestUtil.setMarkToEndOfAllLogs(server);
  OpenAPITestUtil.changeServerPorts(server,server.getHttpSecondaryPort(),server.getHttpSecondarySecurePort());
  openapi=OpenAPIConnection.openAPIDocsConnection(server,false).port(server.getHttpSecondaryPort()).download();
  openapiNode=OpenAPITestUtil.readYamlTree(openapi);
  OpenAPITestUtil.checkServer(openapiNode,OpenAPITestUtil.getServerURLs(server,server.getHttpSecondaryPort(),server.getHttpSecondarySecurePort()));
  openapi=OpenAPIConnection.openAPIDocsConnection(server,true).port(server.getHttpSecondarySecurePort()).download();
  openapiNode=OpenAPITestUtil.readYamlTree(openapi);
  OpenAPITestUtil.checkServer(openapiNode,OpenAPITestUtil.getServerURLs(server,server.getHttpSecondaryPort(),server.getHttpSecondarySecurePort()));
  OpenAPITestUtil.setMarkToEndOfAllLogs(server);
  OpenAPITestUtil.changeServerPorts(server,server.getHttpSecondaryPort(),-1);
  openapi=OpenAPIConnection.openAPIDocsConnection(server,false).port(server.getHttpSecondaryPort()).download();
  openapiNode=OpenAPITestUtil.readYamlTree(openapi);
  OpenAPITestUtil.checkServer(openapiNode,OpenAPITestUtil.getServerURLs(server,server.getHttpSecondaryPort(),-1));
  OpenAPITestUtil.setMarkToEndOfAllLogs(server);
  OpenAPITestUtil.changeServerPorts(server,server.getHttpDefaultPort(),server.getHttpDefaultSecurePort());
}