JDK-4940459 : AudioInputStream.getFrameLength() returns 0 instead of NOT_SPECIFIED
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 1.4.2
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2003-10-20
  • Updated: 2003-10-24
  • 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: rl43681			Date: 10/20/2003


FULL PRODUCT VERSION :
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)


FULL OS VERSION :
Linux shalmaneser 2.6.0-test8 #10 SMP Fri Oct 17 20:17:21 PDT 2003 i686 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
When AudioInputStream is opened with a 16-bit linear PCM AU file that have a data_size equals to AUDIO_UNKNOWN_SIZE (-1), getFrameLength() returns 0 instead of AudioSystem.NOT_SPECIFIED.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.io.*;
import javax.sound.sampled.*;
import junit.framework.*;

public class MediaTest extends TestCase {
	public static Test suite() {
		return new TestSuite(MediaTest.class);
		}

	public void testAu()
		throws Exception {
			
		AudioInputStream is = AudioSystem.getAudioInputStream(new ByteArrayInputStream(new byte[] {
			(byte)0x2E, (byte)0x73, (byte)0x6E, (byte)0x64, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x18,
			(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x03,
			(byte)0x00, (byte)0x00, (byte)0x1F, (byte)0x40, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01,
			(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
			}));
		assertTrue(is.getFrameLength() == AudioSystem.NOT_SPECIFIED);
		assertTrue(is.read(new byte[8]) == 8);
		assertTrue(is.read(new byte[2]) == -1);
		}
	}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Replacing 0x9C by 0x9D at offset 0xB1E of com/sun/media/sound/AuFileReader.class in rt.jar
(Review ID: 216483) 
======================================================================

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

PUBLIC COMMENTS AudioInputStream.getFrameLength() returns 0 instead of NOT_SPECIFIED
10-06-2004

EVALUATION Easy fix for tiger. ###@###.### 2003-10-20
20-10-2003