RFC: JMC-6173: jmc -open requires full path
Erik Gahlin
erik.gahlin at oracle.com
Thu Jun 27 16:04:40 UTC 2019
Hi Carmine ,
Searching the home directory could take a very long time. It could also
open the wrong file if several files have the same name. I don't think
it is the correct approach.
Have you tried Paths.get(".", filename) ?
It will look in the current working directory. To see if the full path
is correct do
path.normalize().toAbsolutePath()
if this doesn't work, it could be because of some magic happening in jmc
launcher, in which case the current directory have to be extracted in
the launcher code.
Erik
> Hi,
>
> On Fri, Jun 21, 2019 at 10:39 AM Jie Kang <jkang at redhat.com> wrote:
>
>> On Fri, Jun 21, 2019 at 8:31 AM Carmine Vincenzo Russo
>> <carusso at redhat.com> wrote:
>>> Hello,
>>>
>>> The patch addresses the issue JMC-6173[0].
>>> I have added a check to see if the path is full or not. If it falls in
>> the
>>> second case, starting from the user home it recursively search for the
>>> given file name in all the not hidden folder.
>>> There was also a problem with relative path like ~/record/test.jfr, now
>>> fixed.
>>> I tested the patch with full path, relative path, filename only and null
>>> value.
>>>
>>> I'm planning to add few tests, at least for a valid filename, an invalid
>>> filename and a null value.
>>>
>>> See the attached patch bellow and let me know what you think.
>> I don't see an attachment unfortunately; was it missed or maybe stripped?
>>
> Carmine sent me a note saying he attached the patch to the e-mail but it
> doesn't appear to show up here. Instead, please find his patch at the
> following webrev:
>
> http://cr.openjdk.java.net/~aptmac/JMC-6173/webrev.00/
>
> I believe he's looking into unit tests at the moment, but wanted feedback
> on his implementation before going forward.
>
>
>> Regards,
>>
>>> Thank you!
>>> Carmine
>>>
>>>
>>> [0] https://bugs.openjdk.java.net/browse/JMC-6173
>>>
>>> --
>>> Carmine Vincenzo Russo
> Cheers,
>
> Alex
More information about the jmc-dev
mailing list