-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0
-
mantis
-
sparc
-
solaris_2.6
Name: dfR10049 Date: 09/07/2000
javax.sound.sampled.AudioSystem.getAudioInputStream(URL url) incorrectly throws
IOException if file encoding is different from ascii and url points
to .aif file. It works good with this url in the ascii encoding
and with another audioformat files in the Cp037 encoding.
This is the test demonstrated the bug:
-------------------------------------
import javax.sound.sampled.*;
import java.io.*;
import java.net.*;
public class SoundTest {
public static void main(String args[]) {
URL soundurl = null;
BufferedWriter log = null;
CharArrayWriter traceWriter = new CharArrayWriter();
try {
log = new BufferedWriter(new
OutputStreamWriter(System.out, "ASCII"));
String soundname = new String (args[0].getBytes(), "ASCII");
soundurl = new URL(soundname);
log.write("url: " + soundurl + '\n');
} catch (IOException e) {
try {
log.write("unexpected exception: " + e + '\n');
log.flush();
} catch (IOException e1) {
}
System.exit(1);
}
boolean thrown = false;
try {
AudioSystem.getAudioInputStream(soundurl);
} catch (UnsupportedAudioFileException e1) {
} catch(IOException ioe) {
ioe.printStackTrace(new PrintWriter(traceWriter));
thrown = true;
}
try {
if (!thrown)
log.write("no exception" + '\n');
else {
log.write("IOException thrown" + '\n');
log.write(traceWriter.toString());
}
log.flush();
} catch (IOException e) {
}
}
}
-------- output from the test ----------------
#> java -Dfile.encoding=Cp037 SoundTest file:/home/fda/work/sound/sound.aif
url: file:/home/fda/work/sound/sound.aif
IOException thrown
java.io.EOFException
at java.io.DataInputStream.readInt(DataInputStream.java:343)
at com.sun.media.sound.AiffFileReader.getCOMM(AiffFileReader.java:353)
at com.sun.media.sound.AiffFileReader.getAudioInputStream(AiffFileReader.java:242)
at com.sun.media.sound.AiffFileReader.getAudioInputStream(AiffFileReader.java:273)
at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:707)
at SoundTest.main(SoundTest.java:31)
#> java -Dfile.encoding=Cp037 SoundTest file:/home/fda/work/sound/sound.au
url: file:/home/fda/work/sound/sound.au
no exception
#> java -Dfile.encoding=Cp037 SoundTest file:/home/fda/work/sound/sound.wav
url: file:/home/fda/work/sound/sound.wav
no exception
#> java SoundTest file:/home/fda/work/sound/sound.aif
url: file:/home/fda/work/sound/sound.aif
no exception
----------------------------------------------
======================================================================
Name: vtR10009 Date: 09/02/2002
This bug causes failure of JCK tests:
api/javax_sound/sampled/AudioInputStream/index.html#getFormat
api/javax_sound/sampled/AudioInputStream/index.html#getFrameLength
api/javax_sound/sampled/AudioSystem/index.html#AudioSystem
======================================================================
- relates to
-
JDK-4303933 MidiSystem fails to load MIDI file on systems with EBCDIC simulation
- Resolved