JDK-4712612 : SPEC: the same resource names in default soundbank
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 1.4.1
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2002-07-10
  • Updated: 2004-03-12
  • Resolved: 2003-10-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 b26Fixed
Description

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.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger tiger-beta FIXED IN: tiger-beta INTEGRATED IN: tiger-b26 tiger-beta VERIFIED IN: tiger-b41
14-06-2004

PUBLIC COMMENTS the same resource names in default soundbank
10-06-2004

EVALUATION Name: fb126949 Date: 07/11/2002 Easy fix, should be fixed for Mantis. ====================================================================== ###@###.### 2002-10-30 Not sure about this bug anymore. Banks are overlapping by default (for compatibility). Programs are uniquely identified by their number, not their name. Furthermore the soundbanks can be changed at will, so I'm not sure if this bug can really be fixed. If no objection from submitter, I will close this bug. ###@###.### 2003-08-07 Closing this bug because it cannot be fixed. Submitter has left Sun. ###@###.### 2003-09-22 Changed to spec bug. The specification should be modified in such a way that it does not mandate unique'ness anymore.
22-09-2003