RFR: JDK-8188856: Incorrect file path in an exception message when .java_pid is not accessible on Unix
gary.adams at oracle.com
gary.adams at oracle.com
Mon Dec 18 21:22:03 UTC 2017
On 12/18/17 2:26 PM, Chris Plummer wrote:
> Hi Gary,
>
> On 12/18/17 6:47 AM, Gary Adams wrote:
>> Here's a simple fix to correct the error message when the java_pid
>> socket
>> is not found. The code previously reported the attach_pid file name
>> rather than the socket file name that was not found.
>>
>> Issue: https://bugs.openjdk.java.net/browse/JDK-8188856
>> Webrev: http://cr.openjdk.java.net/~gadams/8188856/webrev.00/
>
> I don't understand why you couldn't simply have changed the
> f.getPath() reference to "path". From what I can see, there is no
> difference between "path" and "socket_name". The problem you are
> fixing is that the error message prints f.getPath(), but that refers
> to the attach file and the error message should refer to the socket
> file. You've correct this, but have done so in a round about way.
> Above the error message (in two places) exists:
>
> path = findSocketFile(pid, ns_pid);
>
> So "path" is what you want. You have indirectly fixed the problem by
> having findSocketFile() store the path in socket_name, and then you
> print socket_name, but why not just do the direct fix and print "path".
>
> Also, the copyrights need to be updated.
>
> thanks,
>
> Chris
>
>
The problem was path is used to hold the constructed file name
if it is confirmed to exist in the file system. Otherwise it is passed
back from
findSocketFile as a null to indicate the socket file was not found.
I could refactor where the existence check is handled, but it seemed
like the least
invasive change to simply save the socket name for the printing in the
error case.
More information about the serviceability-dev
mailing list