JDK-4489272 : AudioSystem.getAudioFileFormat() fails for InputStream, but works for URL
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 1.3.1
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2001-08-07
  • Updated: 2002-11-20
  • Resolved: 2002-11-20
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.
1.4.2 mantisFixed

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 =
(Review ID: 129385) 

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mantis FIXED IN: mantis INTEGRATED IN: mantis mantis-b08

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.