< prev index next >
test/javax/sound/midi/Sequencer/SeqStartRecording.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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.
@@ -20,29 +20,36 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import javax.sound.midi.MidiSystem;
+import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Sequencer;
/**
* @test
* @bug 5001943
* @summary Sequencer.startRecording throws unexpected NPE
- * @key headful
*/
public class SeqStartRecording {
- public static void main(String argv[]) throws Exception {
- Sequencer seq = MidiSystem.getSequencer();
+
+ public static void main(String argv[]) {
+ Sequencer seq = null;
+ try {
+ seq = MidiSystem.getSequencer();
seq.open();
+ } catch (final MidiUnavailableException ignored) {
+ // the test is not applicable
+ return;
+ }
try {
seq.startRecording();
System.out.println("Test passed.");
} catch (NullPointerException npe) {
System.out.println("Caught NPE: "+npe);
npe.printStackTrace();
- throw new Exception("Test FAILED!");
+ throw new RuntimeException("Test FAILED!");
} catch (Exception e) {
System.out.println("Unexpected Exception: "+e);
e.printStackTrace();
System.out.println("Test NOT failed.");
} finally {
< prev index next >