Hi Kenji,

thanks for this very good point. I thought that JNU_ThrowByNameWithLastError 
just tries to throw the exception manually and if that fails it calls 
JNU_ThrowByName which basically does the same. But I missed the point that it 
does the conversion and tries JNU_ThrowByName only as fallback. So I'll 
revert/correct that. But now I think there are other places in the JDK which 
potentially miss a conversion of strerror result when they go through 
JNU_ThrowIOException for instance. I'll check that.

Please note that the current thread of discussion of my change is this one:
http://mail.openjdk.java.net/pipermail/net-dev/2016-June/009880.html

There is an updated webrev but it obviously still contains this mistake.

Thanks
Christoph



> -----Original Message-----
> From: Kenji Kazumura [mailto:k...@jp.fujitsu.com]
> Sent: Mittwoch, 8. Juni 2016 02:51
> To: Langer, Christoph <christoph.lan...@sap.com>
> Cc: net-...@openjdk.java.net; nio-...@openjdk.java.net; core-libs-
> d...@openjdk.java.net
> Subject: Re: RFR 8158023: SocketExceptions contain too little information
> sometimes
>
> Christoph,
>
> You should not remove conversion codes (platform string to Java String)
> at JNU_ThrowByNameWithLastError,
> and you have to add conversion codes at
> JNU_ThrowByNameWithMessageAndLastError.
>
> It seems that you assume strerror returns only ascii characters, but actually
> not.
> It depends on the locale of your environment where java programs runs.
>
>
> -Kenji Kazumura
>
>
> In message
> <decc19cdab854bbeac7126cb8e236...@dewdfe13de11.global.corp.sap>
>    RFR 8158023: SocketExceptions contain too little information sometimes
>    "Langer, Christoph" <christoph.lan...@sap.com> wrote:
>
> > 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
> >

Reply via email to