RFR 8200706: Better cleanup for open/test/jdk/java/lang/ProcessBuilder/DestroyTest.java

Paul Sandoz paul.sandoz at oracle.com
Fri Apr 6 16:15:28 UTC 2018



> On Apr 6, 2018, at 6:50 AM, Roger Riggs <Roger.Riggs at Oracle.com> wrote:
> 
> Please review an intermittent test bug/cleanup improvement that places temporary
> files in the directory that is auto-cleaned by jtreg.
> 
> Webrev:
>  http://cr.openjdk.java.net/~rriggs/webrev-clean-destroy-8200706/
> 

Looks ok, while you are there, and up to you, you might consider a little refactor of the if/else so there is no repetition of the temp file creation code since it’s the same on all but windows e.g:

  if (osName.startsWith("Windows")) {
    return new WindowsTest();
  }

  File userDir = new File(System.getProperty("user.dir", "."));
  File tmpFile = File.createTempFile("ProcessTrap-", ".sh”, userDir));
  if (osName.startsWith("Linux") == true) {
    return return new UnixTest(tempFile);
  } else if …
  ...
  return null;

Paul.

> Thanks, Roger
> 



More information about the core-libs-dev mailing list