docs: @Sensitive
      protected String restoreHostNameToURL(@Sensitive String referrerURL, String url) {
          if ((referrerURL.startsWith("/")) || (referrerURL.length() == 0)) {
              int doubleSlash = url.indexOf("//");
              int firstSingleSlash = url.indexOf("/", doubleSlash + 2);
              referrerURL = url.substring(0, firstSingleSlash) + referrerURL;
          } else {
              try {
                  URL referrer = new URL(referrerURL);
                  String referrerHost = referrer.getHost();
                  if ((referrerHost == null) || (referrerHost.length() == 0)) {
                      URL currentURL = new URL(url);
                      String currentHost = currentURL.getHost();
                      int doubleSlash = referrerURL.indexOf("//");
                      StringBuffer newURLBuf = new StringBuffer(referrerURL);
                      newURLBuf.insert(doubleSlash + 2, currentHost);
                      referrerURL = newURLBuf.toString();
                  }
              } catch (java.net.MalformedURLException e) {
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                      Tr.debug(tc, "restoreHostNameToURL", new Object[] { e });
                  }
              }
          }
          return referrerURL;
      }