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)
======================================================================