#vulnerable code 
                              public void waitForReady() {
    while (true) {
      System.out.println("Waiting for SonarQube to be available at " + getUrl());
      try {
        HttpURLConnection conn = (HttpURLConnection)getUrl("/api/settings/values.protobuf").openConnection();
        conn.connect();
        int code = conn.getResponseCode();
        if (code == 200) {
          break;
        }
      } catch (IOException e) {
                /* noop */
      }
      try {
        Thread.sleep(5000);
      } catch (InterruptedException e) {
                /* noop */
      }
    }
    System.out.println("SonarQube is ready");
  } 
                            #location 7 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                              public void waitForReady() throws MalformedURLException {
    LOGGER.info("Waiting for SonarQube to be available at {}", getUrl());
    Awaitility
        .await("SonarQube is ready")
        .atMost(3, TimeUnit.MINUTES)
        .pollInterval(5, TimeUnit.SECONDS)
        .ignoreExceptionsInstanceOf(ConnectException.class)
        .until(this::isReady)
    ;
  }