United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4489272 : AudioSystem.getAudioFileFormat() fails for InputStream, but works for URL

Details
Type:
Bug
Submit Date:
2001-08-07
Status:
Resolved
Updated Date:
2002-11-20
Project Name:
JDK
Resolved Date:
2002-11-20
Component:
client-libs
OS:
windows_2000
Sub-Component:
javax.sound
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.3.1
Fixed Versions:
1.4.2 (mantis)

Related Reports

Sub Tasks

Description

Name: krC82822			Date: 08/07/2001


orig synopsis:  "AudioSystem.getAudioFileFormat(InputStream) broken"

java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

The javax.sound.sampled.AudioSystem.getAudioFileFormat() call works differently
for a URL (it works) than for an InputStream (it does not work).

The following program prints out:

WAVE (.wav) file, byte length: 23252, data format: PCM_SIGNED, 44100.0 Hz, 16
bit, mono, little-endian, audio data
WAVE (.wav) file, byte length: 23252, data format: PCM_SIGNED, -1.0 Hz, -1 bit,
mono, audio data

This looks like a bug to me, because they should be reading the same data!

>>>>>cut here<<<<<<
import javax.sound.sampled.*;
import java.net.*;
public class BadSound
{
    public static void main(String args[])
        throws Exception
    {
        URL url = BadSound.class.getResource(args[0]);
        
        AudioFileFormat aff1 = AudioSystem.getAudioFileFormat(url);
        AudioFileFormat aff2 =
AudioSystem.getAudioFileFormat(url.openStream());
        
        System.out.println(aff1);
        System.out.println(aff2);
    }
}
(Review ID: 129385) 
======================================================================

                                    

Comments
EVALUATION


###@###.### 2002-10-30
	bug in AIFF and WAVE readers - since the InputStream method was used internally, it did not read the entire header. Fixed for Mantis.
                                     
2002-10-30
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
mantis

FIXED IN:
mantis

INTEGRATED IN:
mantis
mantis-b08


                                     
2004-06-14



Hardware and Software, Engineered to Work Together