diff -r 323c0edaa17b -r b7cc7f639ecf jdk/test/javax/sound/midi/Gervill/RiffReaderWriter/Close.java --- a/jdk/test/javax/sound/midi/Gervill/RiffReaderWriter/Close.java Fri May 05 08:34:22 2017 -0700 +++ b/jdk/test/javax/sound/midi/Gervill/RiffReaderWriter/Close.java Sat May 06 13:17:36 2017 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,10 +28,11 @@ import java.io.File; import java.io.FileInputStream; +import java.nio.file.Files; +import java.nio.file.Paths; -import javax.sound.sampled.*; - -import com.sun.media.sound.*; +import com.sun.media.sound.RIFFReader; +import com.sun.media.sound.RIFFWriter; public class Close { @@ -54,8 +55,6 @@ reader = new RIFFReader(fis); reader.close(); reader = null; - - } finally { @@ -63,10 +62,7 @@ writer.close(); if(reader != null) reader.close(); - - if(tempfile.exists()) - if(!tempfile.delete()) - tempfile.deleteOnExit(); + Files.delete(Paths.get(tempfile.getAbsolutePath())); } } }