--- old/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/MarkSupported.java 2016-08-22 18:33:56.765657800 +0300 +++ new/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/MarkSupported.java 2016-08-22 18:33:56.419638000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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,8 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +56,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception {