6806019: 38 JCK api/javax_sound/midi/ tests fails starting from jdk7 b46
Reviewed-by: kalli
This commit is contained in:
parent
d15fceaa77
commit
9a0763bf6b
@ -889,9 +889,12 @@ public class SoftSynthesizer implements AudioSynthesizer,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
synchronized (control_mutex) {
|
synchronized (control_mutex) {
|
||||||
|
Throwable causeException = null;
|
||||||
try {
|
try {
|
||||||
if (line != null)
|
if (line != null) {
|
||||||
|
// can throw IllegalArgumentException
|
||||||
setFormat(line.getFormat());
|
setFormat(line.getFormat());
|
||||||
|
}
|
||||||
|
|
||||||
AudioInputStream ais = openStream(getFormat(), info);
|
AudioInputStream ais = openStream(getFormat(), info);
|
||||||
|
|
||||||
@ -900,10 +903,13 @@ public class SoftSynthesizer implements AudioSynthesizer,
|
|||||||
|
|
||||||
if (line == null)
|
if (line == null)
|
||||||
{
|
{
|
||||||
if(testline != null)
|
if (testline != null) {
|
||||||
line = testline;
|
line = testline;
|
||||||
else
|
} else {
|
||||||
|
// can throw LineUnavailableException,
|
||||||
|
// IllegalArgumentException, SecurityException
|
||||||
line = AudioSystem.getSourceDataLine(getFormat());
|
line = AudioSystem.getSourceDataLine(getFormat());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double latency = this.latency;
|
double latency = this.latency;
|
||||||
@ -911,6 +917,8 @@ public class SoftSynthesizer implements AudioSynthesizer,
|
|||||||
if (!line.isOpen()) {
|
if (!line.isOpen()) {
|
||||||
int bufferSize = getFormat().getFrameSize()
|
int bufferSize = getFormat().getFrameSize()
|
||||||
* (int)(getFormat().getFrameRate() * (latency/1000000f));
|
* (int)(getFormat().getFrameRate() * (latency/1000000f));
|
||||||
|
// can throw LineUnavailableException,
|
||||||
|
// IllegalArgumentException, SecurityException
|
||||||
line.open(getFormat(), bufferSize);
|
line.open(getFormat(), bufferSize);
|
||||||
|
|
||||||
// Remember that we opened that line
|
// Remember that we opened that line
|
||||||
@ -954,13 +962,22 @@ public class SoftSynthesizer implements AudioSynthesizer,
|
|||||||
weakstream.sourceDataLine = sourceDataLine;
|
weakstream.sourceDataLine = sourceDataLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} catch (LineUnavailableException e) {
|
} catch (LineUnavailableException e) {
|
||||||
|
causeException = e;
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
causeException = e;
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
causeException = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (causeException != null) {
|
||||||
if (isOpen())
|
if (isOpen())
|
||||||
close();
|
close();
|
||||||
// am: need MidiUnavailableException(Throwable) ctor!
|
// am: need MidiUnavailableException(Throwable) ctor!
|
||||||
throw new MidiUnavailableException(e.toString());
|
MidiUnavailableException ex = new MidiUnavailableException(
|
||||||
|
"Can not open line");
|
||||||
|
ex.initCause(causeException);
|
||||||
|
throw ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user