private static void checkRequestHeadersForNulBytes(URLConnection connection) {
    for (Map.Entry<String, List<String>> header : connection.getRequestProperties().entrySet()) {
      for (String headerValue : header.getValue()) {
        if (headerValue.indexOf('\0') >= 0) {
          connection.setRequestProperty(header.getKey(), null);
          LOG.error(String.format("Problem during request to '%s'. Header's '%s' value contains NUL bytes: '%s'. Omitting this header.",
                                  connection.getURL().toString(), header.getKey(), headerValue));
          break;
        }
      }
    }
  }
private static void checkRequestHeadersForNulBytes(URLConnection connection)