RFR 9: 8136597 : java/lang/ProcessHandle/InfoTest.java fails: commandLine() should at least contain 'java'

Roger Riggs Roger.Riggs at Oracle.com
Mon Dec 21 16:21:26 UTC 2015


Hi Claes,

I considered that, but it might be that the command line contained 
'java' in the path name (not at the end)
or that the truncation occurred just after 'java' in the pathname.

With the possibility of truncation, there may be no reliable test at all 
and it should be removed.

Roger


On 12/21/2015 11:10 AM, Claes Redestad wrote:
> Hi,
>
> On 2015-12-21 16:40, Roger Riggs wrote:
>> Please review this test fix to allow the test to pass even if the OS 
>> provided commandline information is truncated and does not include 
>> the full command.  It appears on Solaris when the path to the java 
>> command is longer than 80 chars.
>>
>> webrev:
>>   http://cr.openjdk.java.net/~rriggs/webrev-info-8136597/
>
> this looks OK as a fix to the Solaris issue, but it seems fragile 
> since it'd likely break if you ran the test from a directory 
> containing spaces. If we only do the space-check if we first fail to 
> find java/java.exe in the commandLine we avoid this fragility:
>
> // calculate position of java
> int pos = commandLine.indexOf(javaExe);
> if (pos == -1) {
>     pos = commandLine.indexOf(' ');
>     if (pos != -1) {
>         pos = pos - javaExe.length();
>     }
> }
>
> if (pos != 0) {
>     Assert...
>
> Thanks!
>
> /Claes
>
>
>>
>> Issue:
>>   https://bugs.openjdk.java.net/browse/JDK-8136597
>>
>> Thanks, Roger
>>
>




More information about the core-libs-dev mailing list