< prev index next >

test/javax/sound/midi/Sequencer/SeqStartRecording.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2004, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * 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,48 **** * or visit www.oracle.com if you need additional information or have any * questions. */ import javax.sound.midi.MidiSystem; 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(); seq.open(); try { seq.startRecording(); System.out.println("Test passed."); } catch (NullPointerException npe) { System.out.println("Caught NPE: "+npe); npe.printStackTrace(); ! throw new Exception("Test FAILED!"); } catch (Exception e) { System.out.println("Unexpected Exception: "+e); e.printStackTrace(); System.out.println("Test NOT failed."); } finally { --- 20,55 ---- * 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 */ public class SeqStartRecording { ! ! 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 RuntimeException("Test FAILED!"); } catch (Exception e) { System.out.println("Unexpected Exception: "+e); e.printStackTrace(); System.out.println("Test NOT failed."); } finally {
< prev index next >