< prev index next >

test/javax/sound/midi/Gervill/RiffReaderWriter/ReadShort.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -26,14 +26,15 @@
    @modules java.desktop/com.sun.media.sound
 */
 
 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 ReadShort {
 
     private static void assertEquals(Object a, Object b) throws Exception
     {

@@ -59,21 +60,16 @@
             RIFFReader readchunk = reader.nextChunk();
             assertEquals(readchunk.getFormat(), "TSCH");
             assertEquals(reader.readShort(), (short)133);
             fis.close();
             reader = null;
-
-
         }
         finally
         {
             if(writer != null)
                 writer.close();
             if(reader != null)
                 reader.close();
-
-            if(tempfile.exists())
-                if(!tempfile.delete())
-                    tempfile.deleteOnExit();
+            Files.delete(Paths.get(tempfile.getAbsolutePath()));
         }
     }
 }
< prev index next >