Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/javax/sound/sampled/Mixers/UnexpectedIAE.java
41153 views
1
/*
2
* Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
import javax.sound.sampled.AudioSystem;
25
import javax.sound.sampled.Line;
26
import javax.sound.sampled.LineUnavailableException;
27
import javax.sound.sampled.Mixer;
28
29
/**
30
* @test
31
* @bug 4964288
32
* @summary Unexpected IAE raised while getting TargetDataLine
33
*/
34
public class UnexpectedIAE {
35
36
public static void main(String argv[]) throws Exception {
37
boolean success = true;
38
39
Mixer.Info [] infos = AudioSystem.getMixerInfo();
40
41
for (int i=0; i<infos.length; i++) {
42
Mixer mixer = AudioSystem.getMixer(infos[i]);
43
System.out.println("Mixer is: " + mixer);
44
Line.Info [] target_line_infos = mixer.getTargetLineInfo();
45
for (int j = 0; j < target_line_infos.length; j++) {
46
try {
47
System.out.println("Trying to get:" + target_line_infos[j]);
48
mixer.getLine(target_line_infos[j]);
49
} catch (IllegalArgumentException iae) {
50
System.out.println("Unexpected IllegalArgumentException raised:");
51
iae.printStackTrace();
52
success = false;
53
} catch (LineUnavailableException lue) {
54
System.out.println("Unexpected LineUnavailableException raised:");
55
lue.printStackTrace();
56
success = false;
57
}
58
}
59
}
60
if (success) {
61
System.out.println("Test passed");
62
} else {
63
throw new Exception("Test FAILED");
64
}
65
}
66
}
67
68