<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    I agree we should do something about this. I will make some
    enquiries with<br>
    the security folks here as to what might be permitted. I suspect
    either some kind<br>
    of debugging property/switch to enable it, or the limited
    information only being<br>
    provided when a security manager is enabled, might work.<br>
    <br>
    I will get back with a firm proposal.<br>
    <br>
    Thanks,<br>
    <br>
    Michael.<br>
    <br>
    On 23/04/2018, 10:05, Péter Gergely Horváth wrote:
    <blockquote
cite="mid:CAGkyZ3kG9AVsCdicvUAm3YF1_9kN9Lc0BxC3TF6+cSZca0qafA@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi Tobias,
        <div><br>
        </div>
        <div>Thank you for pointing me to that thread: it's good to have
          that context (it was sent before I joined the mailing list, so
          please bear with me).</div>
        <div><br>
        </div>
        <div>I understand the JDK developers want to be safe than sorry
          around reporting target addresses and I absolutely agree with
          that point. </div>
        <div><br>
        </div>
        <div>However considering how useful it would be to have this
          _optionally_ for debugging, I am wondering if it would be
          possible to have a dedicated Java system property defined for
          this (e.g. 'java.net.socket.reportAddressInException' or
          something like that), which would enable this behaviour
          (retaining the current behaviour of <span
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">*</span>not
          reporting anything by default.*).</div>
        <div><br>
        </div>
        <div>What do you think about this, guys? With this in place both
          the secure-by-default requirement would be met, and there
          would be a powerful tool available to fight the horrors of
          debugging a running complex distributed application from its
          logs.</div>
        <div><br>
        </div>
        <div>Thanks,</div>
        <div>Peter</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Sun, Apr 22, 2018 at 10:21 PM, James
          Roper <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:james@lightbend.com" target="_blank">james@lightbend.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">This would be especially useful in
              asynchronous applications - since in those cases the
              exception rarely maps back to a place in user code that
              would indicate what is being connected to. As someone who
              has spent a lot of time supporting developers who use
              asynchronous libraries and post exceptions of this nature
              (supporting both in open source, eg on stack overflow, as
              well as providing commercial support), where I don't have
              access to their code base so I can't do the necessary
              investigations directly myself, having the attempted
              address and port in the error message would save a lot of
              time, and probably even prevent a lot of people from
              requiring support in the first place.</div>
            <div class="gmail_extra">
              <div>
                <div class="h5"><br>
                  <div class="gmail_quote">On 22 April 2018 at 20:59,
                    Péter Gergely Horváth <span dir="ltr"><<a
                        moz-do-not-send="true"
                        href="mailto:peter.gergely.horvath@gmail.com"
                        target="_blank">peter.gergely.horvath@gmail.<wbr>com</a>></span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div dir="ltr">Hi All,
                        <div><br>
                        </div>
                        <div>I am wondering if it would be possible to
                          make a minor improvement to the way <font
                            face="monospace, monospace"><b>java.net.Socket</b></font> reports
                          connectivity errors and incorporate the
                          attempted address, port and the timeout used
                          into the exception message.</div>
                        <div><br>
                        </div>
                        <div>The current implementation emits a generic
                          error message, which is not that helpful when
                          one is operating a _large_ application.
                          (Consider e.g. Big Data or complex legacy
                          systems written by someone else).</div>
                        <div><br>
                        </div>
                        <div>
                          <div><font face="monospace, monospace">java.net.ConnectException:
                              Connection refused (Connection refused)</font></div>
                          <div><font face="monospace, monospace"><span
                                style="white-space:pre-wrap"> </span>at
                              java.net.PlainSocketImpl.socke<wbr>tConnect(Native
                              Method)</font></div>
                          <div><font face="monospace, monospace"><span
                                style="white-space:pre-wrap"> </span>at
                              <a moz-do-not-send="true"
                                href="http://java.net" target="_blank">java.net</a>.AbstractPlainSocketIm<wbr>pl.doConnect(AbstractPlainSock<wbr>etImpl.java:350)</font></div>
                          <div><font face="monospace, monospace"><span
                                style="white-space:pre-wrap"> </span>at
                              <a moz-do-not-send="true"
                                href="http://java.net" target="_blank">java.net</a>.AbstractPlainSocketIm<wbr>pl.connectToAddress(AbstractPl<wbr>ainSocketImpl.java:206)</font></div>
                          <div><font face="monospace, monospace"><span
                                style="white-space:pre-wrap"> </span>at
                              <a moz-do-not-send="true"
                                href="http://java.net" target="_blank">java.net</a>.AbstractPlainSocketIm<wbr>pl.connect(AbstractPlainSocket<wbr>Impl.java:188)</font></div>
                          <div><font face="monospace, monospace"><span
                                style="white-space:pre-wrap"> </span>at
                              java.net.SocksSocketImpl.conne<wbr>ct(SocksSocketImpl.java:392)</font></div>
                          <div><font face="monospace, monospace"><span
                                style="white-space:pre-wrap"> </span>at
                              java.net.Socket.connect(Socket<wbr>.java:589)</font></div>
                          <div><font face="monospace, monospace"><span
                                style="white-space:pre-wrap"> </span>at
                              java.net.Socket.connect(Socket<wbr>.java:538)</font></div>
                          <div><font face="monospace, monospace"><span
                                style="white-space:pre-wrap"> </span>at
                              java.net.Socket.<init>(Socket.<wbr>java:434)</font></div>
                          <div><font face="monospace, monospace"><span
                                style="white-space:pre-wrap"> </span>at
                              java.net.Socket.<init>(Socket.<wbr>java:211)</font></div>
                          <div><font face="monospace, monospace"><span
                                style="white-space:pre-wrap"> </span>at
                              Sample.main(Sample.java:9)</font></div>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div>I have looked into the JDK code base and
                          implemented a patch that reports the address,
                          port and timeout used in the error message
                          without touching any native parts (see
                          attached patch file). I have tested this
                          (created my own build of the JDK and run a
                          sample application against it) and it seems to
                          work properly.</div>
                        <div><br>
                        </div>
                        <div>Would it be possible to incorporate this
                          change into the official JDK code base? I do
                          believe it would help a lot of people out
                          there. </div>
                        <div><br>
                        </div>
                        <div>Based on my understanding, once I have
                          signed the OCA, I should simply write an email
                          to the group and request a sponsor to pick up
                          this issue. Could someone help me with this?</div>
                        <div><br>
                        </div>
                        <div>Thank you,</div>
                        <div>Peter</div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                      </div>
                    </blockquote>
                  </div>
                  <br>
                  <br clear="all">
                  <div><br>
                  </div>
                </div>
              </div>
              <span class="HOEnZb"><font color="#888888">-- <br>
                  <div class="m_7694348255484147030gmail_signature"
                    data-smartmail="gmail_signature">
                    <div dir="ltr">
                      <div>
                        <div dir="ltr">
                          <div>
                            <div dir="ltr">
                              <div>
                                <div dir="ltr">
                                  <div dir="ltr">
                                    <div dir="ltr">
                                      <div dir="ltr">
                                        <div dir="ltr"><span
                                            style="font-size:12.8px;border-collapse:collapse"><font
                                              color="#000000"><b>James
                                                Roper</b><br>
                                              <i>Senior Octonaut</i></font></span></div>
                                        <div><br>
                                        </div>
                                        <div><font color="#000000"><font
                                              face="arial, helvetica,
                                              sans-serif" size="2"><a
                                                moz-do-not-send="true"
                                                href="https://www.lightbend.com/"
                                                target="_blank">Lightbend</a> – </font><span
                                              style="font-size:12.8px">Build
                                              reactive apps!</span><font
                                              face="arial, helvetica,
                                              sans-serif" size="2"><br>
                                              Twitter: <a
                                                moz-do-not-send="true"
                                                href="https://twitter.com/jroper"
                                                target="_blank">@jroper</a></font></font><br>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </font></span></div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
  </body>
</html>