Program: 59237
Project: 59237
Buggy source:
private URL resolveUrl(){
  final UrlBuilder urlBuilder=UrlBuilder.create();
  final GrapheneConfiguration grapheneConfiguration=this.grapheneConfiguration.get();
  if (grapheneConfiguration.getScheme() != null) {
    urlBuilder.protocol(grapheneConfiguration.getScheme());
  }
  final CubeDockerConfiguration cubeDockerConfiguration=cubeDockerConfigurationInstance.get();
  final String configuredUrl=grapheneConfiguration.getUrl();
  if (configuredUrl != null && !configuredUrl.isEmpty()) {
    if (isAnAbsoluteUrl(configuredUrl) || startWithDockerHost(configuredUrl)) {
      String replacedWithDockerHostUrl=configuredUrl;
      if (isAnAbsoluteUrl(configuredUrl)) {
        replacedWithDockerHostUrl=configuredUrl.substring(1);
      }
      replacedWithDockerHostUrl=replacedWithDockerHostUrl.replace("String_Node_Str",cubeDockerConfiguration.getDockerServerIp());
      String host=resolveHost(replacedWithDockerHostUrl);
      if (!IpAddressValidator.validate(host)) {
        host=getInternalIp(cubeDockerConfiguration,host);
      }
      urlBuilder.host(host);
      int port=extractPort(replacedWithDockerHostUrl);
      if (port == NO_PORT) {
        port=8080;
      }
      urlBuilder.port(port);
      urlBuilder.context(resolveContext(replacedWithDockerHostUrl));
    }
 else {
      final SinglePortBindResolver.PortBindInfo portBindInfo=resolveBindPort(NO_PORT);
      urlBuilder.host(getInternalIp(cubeDockerConfiguration,portBindInfo.getContainerName()));
      urlBuilder.port(portBindInfo.getExposedPort());
      urlBuilder.context(configuredUrl);
    }
  }
 else {
    final SinglePortBindResolver.PortBindInfo portBindInfo=resolveBindPort(NO_PORT);
    urlBuilder.host(getInternalIp(cubeDockerConfiguration,portBindInfo.getContainerName()));
    urlBuilder.port(portBindInfo.getExposedPort());
  }
  try {
    return urlBuilder.build();
  }
 catch (  MalformedURLException e) {
    throw new IllegalStateException("String_Node_Str");
  }
}

Fixed version (ground truth):
private URL resolveUrl() throws MalformedURLException {
  final UrlBuilder urlBuilder=UrlBuilder.create();
  final GrapheneConfiguration grapheneConfiguration=this.grapheneConfiguration.get();
  if (grapheneConfiguration.getScheme() != null) {
    urlBuilder.protocol(grapheneConfiguration.getScheme());
  }
  final CubeDockerConfiguration cubeDockerConfiguration=cubeDockerConfigurationInstance.get();
  final String configuredUrl=grapheneConfiguration.getUrl();
  if (configuredUrl != null && !configuredUrl.isEmpty()) {
    String replacedWithDockerHostUrl=configuredUrl;
    replacedWithDockerHostUrl=replacedWithDockerHostUrl.replace("String_Node_Str",cubeDockerConfiguration.getDockerServerIp());
    URL currentUrl=new URL(replacedWithDockerHostUrl);
    String host=currentUrl.getHost();
    if (!IpAddressValidator.validate(host)) {
      host=getInternalIp(cubeDockerConfiguration,host);
    }
    urlBuilder.host(host);
    int port=currentUrl.getPort();
    if (port == NO_PORT) {
      port=80;
    }
    urlBuilder.port(port);
    urlBuilder.context(currentUrl.getPath());
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  try {
    return urlBuilder.build();
  }
 catch (  MalformedURLException e) {
    throw new IllegalStateException("String_Node_Str");
  }
}