-
Bug
-
Resolution: Fixed
-
P3
-
1.4.1
-
b26
-
generic
-
generic
-
Verified
Name: vtR10009 Date: 07/10/2002
Specification for the method SoundbankResource.getName() from the
package javax.sound.midi reads:
".. This should generally be a string descriptive of the resource, and it
should be unique within a given soundbank, so that a user can select an
instrument based on its name."
But default soundbank in the reference implementation contains resources
and instruments with the same names.
This bug causes failure of new JCK test:
api/javax_sound/midi/SoundbankResource/index.html#getName
To reproduce the bug run the following test with JDK build 1.4.1-rc-b16:
------------------------------- test.java --------------------------------
import java.io.*;
import javax.sound.midi.*;
public class test {
public static void main(String args[]) {
boolean failed = false;
SoundbankResource[] resArr;
SoundbankResource[] instArr;
Synthesizer synth = null;
SoundbankResource res;
Soundbank bank;
try {
synth = MidiSystem.getSynthesizer();
synth.open();
bank = synth.getDefaultSoundbank();
if (bank == null) {
System.err.println("No default soundbank!");
System.exit(1);
}
resArr = bank.getInstruments();
if (resArr.length == 0) {
System.err.println("No instruments!");
System.exit(1);
}
for (int i = 0; i < (resArr.length - 1); i++) {
res = resArr[i];
for (int j = i + 1; j < resArr.length; j++) {
if (resArr[i].getName().equals(resArr[j].getName())) {
failed = true;
System.err.println(" Two instruments have identical
names: "
+ resArr[i].getName());
System.err.println(" resources: " + i + " and " + j);
}
}
}
System.out.println("---------------------------------------------------");
resArr = bank.getResources();
instArr = bank.getInstruments();
if (resArr.length == 0) {
System.err.println("No Resources!");
System.exit(1);
}
if (resArr.length == 0) {
System.err.println("No instruments!");
System.exit(1);
}
for (int i = 0; i < resArr.length; i++) {
res = resArr[i];
for (int j = 0; j < instArr.length; j++) {
if (resArr[i].getName().equals(instArr[j].getName())) {
failed = true;
System.err.println(" Resource and instrument have
identical names: "
+ resArr[i].getName());
System.err.println(" resources: " + i + " and " + j);
}
}
}
} catch (MidiUnavailableException mue) {
System.err.println("MidiUnavailableException was thrown: " + mue);
failed = true;
} finally {
if (synth != null) synth.close();
}
if( failed ) {
System.err.println("test failed");
System.exit(1);
} else {
System.out.println("OKAY");
System.exit(0);
}
}
}
---------------------------Logs-------------------------------------------
novo101:templates$ javac test.java; java -showversion test
java version "1.4.1-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-rc-b16)
Java HotSpot(TM) Client VM (build 1.4.1-rc-b16, mixed mode)
Two instruments have identical names: Tom Hi
resources: 144 and 146
Two instruments have identical names: tablaesque_lo
resources: 319 and 365
Two instruments have identical names: tablaesque_hi
resources: 320 and 366
Two instruments have identical names: nine_inch_kick
resources: 321 and 367
Two instruments have identical names: hippishake
resources: 322 and 368
Two instruments have identical names: ScienceTom
resources: 323 and 369
Two instruments have identical names: click
resources: 324 and 370
Two instruments have identical names: rvs cymb pan long
resources: 325 and 371
Two instruments have identical names: rvs cymb pan med
resources: 326 and 372
Two instruments have identical names: rvs cymb pan shrt
resources: 327 and 373
Two instruments have identical names: woodstick
resources: 328 and 374
Two instruments have identical names: electrobrite
resources: 329 and 375
Two instruments have identical names: SloLaser
resources: 330 and 376
Two instruments have identical names: ufo-by
resources: 331 and 377
Two instruments have identical names: air snare
resources: 332 and 378
Two instruments have identical names: weird snare
resources: 333 and 379
Two instruments have identical names: flange snare
resources: 334 and 380
Two instruments have identical names: ping drum
resources: 335 and 381
Two instruments have identical names: itchy-scratch
resources: 336 and 382
Two instruments have identical names: itchy-scratch2
resources: 337 and 383
Two instruments have identical names: hi_metallic_snare
resources: 338 and 384
Two instruments have identical names: noise echo
resources: 339 and 385
Two instruments have identical names: buzzy hit
resources: 340 and 386
Two instruments have identical names: rez_hat
resources: 341 and 387
Two instruments have identical names: bucket hit
resources: 342 and 388
Two instruments have identical names: icecube
resources: 343 and 389
Two instruments have identical names: explosive kick
resources: 344 and 390
Two instruments have identical names: mutant cowbell
resources: 345 and 391
Two instruments have identical names: Temple Bell
resources: 346 and 392
Two instruments have identical names: Hi Temple Gong
resources: 347 and 393
Two instruments have identical names: Thuddy Kick
resources: 348 and 394
Two instruments have identical names: LoBell
resources: 349 and 395
Two instruments have identical names: sinechirp
resources: 350 and 396
Two instruments have identical names: hollow_metal_hit
resources: 351 and 397
Two instruments have identical names: woodblock
resources: 352 and 398
Two instruments have identical names: reverse cymbal
resources: 353 and 399
Two instruments have identical names: tablaesque_slap
resources: 354 and 400
Two instruments have identical names: sonarblip
resources: 355 and 401
Two instruments have identical names: sinehit
resources: 356 and 402
Two instruments have identical names: sineblock
resources: 357 and 403
Two instruments have identical names: Krelltone
resources: 358 and 404
Two instruments have identical names: sine_kick
resources: 359 and 405
Two instruments have identical names: hi-tone*
resources: 360 and 406
Two instruments have identical names: hi-click
resources: 361 and 407
Two instruments have identical names: Gate-tone
resources: 362 and 408
Two instruments have identical names: chem-tone
resources: 363 and 409
Two instruments have identical names: dub_kick
resources: 364 and 410
---------------------------------------------------
Resource and instrument have identical names: woodblock
resources: 101 and 352
Resource and instrument have identical names: woodblock
resources: 101 and 398
test failed
--------------------------------------------------------------------------
======================================================================
###@###.### 2003-08-07
Changing resp. eng. to me.
###@###.### 2003-08-07
Reopened bug, removed commited to, fixed in, Integrated in, Verified in
Closed because we will not fix bug.
###@###.### 2003-10-23
We fixed it after all.