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

Claes Redestad claes.redestad at oracle.com
Mon Dec 21 16:10:46 UTC 2015


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