Ping - RFR 8158023: SocketExceptions contain too little information sometimes
Langer, Christoph
christoph.langer at sap.com
Mon Jun 6 08:42:29 UTC 2016
Hi,
this is another ping. Any review for my update?
Thanks
Christoph
-----Original Message-----
From: Langer, Christoph
Sent: Mittwoch, 1. Juni 2016 23:59
To: 'Chris Hegarty' <chris.hegarty at oracle.com>; Bernd Eckenfels <ecki at zusammenkunft.net>
Cc: net-dev at openjdk.java.net
Subject: RE: Ping - RFR 8158023: SocketExceptions contain too little information sometimes
Hi Chris, Bernd,
ok, here is the new webrev: http://cr.openjdk.java.net/~clanger/webrevs/8158023.2/
I reduced the set of changes to do just the following:
1. clean up JNU_ThrowByNameWithLastError a little bit without changing its behavior, that is just use the last error string representation as message text and use the passed text message only as fallback.
2. add JNU_ThrowByNameWithMessageAndLastError to throw an Exception with message text consisting of a passed text message and the last error string representation
3. change all calls to create a SocketException to use JNU_ThrowByNameWithMessageAndLastError instead of NET_ThrowByNameWithLastError.
This will now deliver an enhanced text message for SocketExceptions where it was not always straightforward to see which OS call would return an errno and hence cause the Exception.
@Bernd: As for errno number output, as I mentioned before, this would usually not be seen since most probably for all error cases a text message could be obtained. At least I never saw an errno number in any exception so far.
Then we can later decide whether to completely drop NET_ThrowByNameWithLastError and replace it with JNU_ThrowByNameWithLastError. I would say this makes sense but for sure we can leave it in if you dislike the idea of dropping it.
What do you think of the new proposal?
Thanks and best regards
Christoph
> -----Original Message-----
> From: Chris Hegarty [mailto:chris.hegarty at oracle.com]
> Sent: Mittwoch, 1. Juni 2016 11:26
> To: Langer, Christoph <christoph.langer at sap.com>
> Cc: net-dev at openjdk.java.net; Bernd Eckenfels <ecki at zusammenkunft.net>
> Subject: Re: Ping - RFR 8158023: SocketExceptions contain too little information
> sometimes
>
> Christoph,
>
> > On 1 Jun 2016, at 08:33, ecki at zusammenkunft.net wrote:
> >
> > Hello,
> >
> > Since nobody commented, here is my non binding comment:
> >
> > I am not sure which Exception call-site actually improved (i.e. added the error
> code)? I would split out the improvement of this/those throws and the
> refacturing of the code.
>
> Yes, please.
>
> > Personally I would prefer to keep the NET_ variant and adjust the native
> utilities to remove code duplication.
>
> Also I dislike the change from "java/net/SocketException” to JNU_JAVANETPKG
> “SocketException”.
> My preference is to keep the former / original.
>
> > Does your new version still contain the nummric error code (os error
> messages are unfortunatelly translated).
>
> -Chris.
>
> > Gruss
> > Bernd
> > --
> > http://bernd.eckenfels.net
> >
> > -----Original Message-----
> > From: "Langer, Christoph" <christoph.langer at sap.com>
> > To: "net-dev at openjdk.java.net" <net-dev at openjdk.java.net>
> > Sent: Mi., 01 Juni 2016 9:20
> > Subject: Ping - RFR 8158023: SocketExceptions contain too little information
> sometimes
> >
> > Hi,
> >
> > ping - any comments on this?
> >
> > Thanks
> > Christoph
> >
> > From: Langer, Christoph
> > Sent: Freitag, 27. Mai 2016 10:30
> > To: net-dev at openjdk.java.net
> > Cc: core-libs-dev at openjdk.java.net; nio-dev at openjdk.java.net
> > Subject: RFR 8158023: SocketExceptions contain too little information
> sometimes
> >
> > Hi all,
> >
> > please review the following change:
> > Webrev: http://cr.openjdk.java.net/~clanger/webrevs/8158023.1/
> > Bug: https://bugs.openjdk.java.net/browse/JDK-8158023
> >
> > During error analysis I stumbled over a place where I encountered a
> SocketException which was thrown along with some strerror information as
> message. I found it hard to find the originating code spot with that information.
> >
> > So I looked at the places where we throw exceptions, namely JNU_Throw...
> and NET_Throw... functions and came up with the following enhancement:
> > - NET_ThrowByNameWithLastError can go completely as it does not provide
> any benefit over JNU_ThrowByNameWithLastError.
> > - JNU_ThrowByNameWithLastError can be cleaned up.
> >
> > - I added JNU_ThrowByNameWithMessageAndLastError to print out a string
> like message + ": " + last error.
> >
> > - I went over all places where NET_ThrowByNameWithLastError is used and
> replaced it appropriately.
> >
> > Do you think this change is desirable/possible?
> >
> > Though it's mainly a net topic, I'm posting it to nio-dev and core-libs-dev as
> well as JNU_Throw... code affects all.
> >
> > Best regards
> > Christoph
> >
More information about the net-dev
mailing list