-
Bug
-
Resolution: Unresolved
-
P4
-
1.4.2
-
generic
-
generic
Name: dkR10031 Date: 12/26/2002
The current reference implementation (JDK 1.4.2beta, build b11)
of the following javax_sound methods throws unspecified
NullPointerException.
This behavior seems quite reasonable but is not specified.
According to "Requirements for Writing Java API Specifications" at
http://java.sun.com/j2se/javadoc/writingapispecs/index.html
the behavior for null argument values should be described either at
the package, class or method level.
Unspecified NPE is thrown in the case when null object is passed in as
actual argument by the following methods:
javax.sound.midi.Sequencer:
int[] addControllerEventListener(ControllerEventListener listener, int[] controllers),
void setSequence(InputStream stream),
void setSequence(Sequence sequence),
javax.sound.midi.Soundbank:
public Instrument getInstrument(Patch patch),
javax.sound.midi.Synthesizer:
boolean loadAllInstruments(Soundbank soundbank),
boolean loadInstrument(Instrument instrument),
boolean loadInstruments(Soundbank soundbank, Patch[] patchList),
boolean remapInstrument(Instrument from, Instrument to),
void unloadAllInstruments(Soundbank soundbank),
void unloadInstrument(Instrument instrument),
void unloadInstruments(Soundbank soundbank, Patch[] patchList),
javax.sound.midi.MetaMessage:
protected MetaMessage(byte[] data),
javax.sound.midi.MidiMessage:
protected MidiMessage(byte[] data),
protected void setMessage(byte[] data, int length),
javax.sound.midi.MidiSystem:
static MidiDevice getMidiDevice(MidiDevice.Info info),
static MidiFileFormat getMidiFileFormat(File file),
static MidiFileFormat getMidiFileFormat(InputStream stream),
static MidiFileFormat getMidiFileFormat(URL url),
static int[] getMidiFileTypes(Sequence sequence),
static Sequence getSequence(File file),
static Sequence getSequence(InputStream stream),
static Sequence getSequence(URL url),
static Soundbank MidiSystem.getSoundbank(File file),
static Soundbank MidiSystem.getSoundbank(InputStream stream),
static Soundbank MidiSystem.getSoundbank(URL url),
static boolean isFileTypeSupported(int fileType, Sequence sequence),
static int write(Sequence in, int type, File out),
static int write(Sequence in, int fileType, OutputStream out),
javax.sound.midi.SysexMessage:
void setMessage(byte[] data, int length),
void setMessage(int status, byte[] data, int length),
javax.sound.midi.Track:
boolean add(MidiEvent event),
javax.sound.sampled.Clip:
void open(AudioFormat format, byte[] data, int offset, int bufferSize),
void open(AudioInputStream stream),
javax.sound.sampled.Mixer:
boolean isLineSupported(Line.Info info),
javax.sound.sampled.SourceDataLine:
void open(AudioFormat format),
void open(AudioFormat format, int bufferSize),
javax.sound.sampled.TargetDataLine:
void open(AudioFormat format),
void open(AudioFormat format, int bufferSize),
javax.sound.sampled.AudioInputStream:
AudioInputStream(InputStream stream, AudioFormat format, long length),
AudioInputStream(TargetDataLine line),
int read(byte[] b),
int read(byte[] b, int off, int len),
javax.sound.sampled.AudioInputStream:
AudioPermission(String name),
AudioPermission(String name, String actions),
javax.sound.sampled.AudioSystem:
static AudioFileFormat getAudioFileFormat(File file),
static AudioFileFormat getAudioFileFormat(InputStream stream),
static AudioFileFormat getAudioFileFormat(URL url),
static AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream),
static AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream),
static AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream),
static AudioInputStream getAudioInputStream(File file),
static AudioInputStream getAudioInputStream(InputStream stream)
static AudioInputStream getAudioInputStream(URL url),
static Line getLine(Line.Info info),
static Mixer getMixer(Mixer.Info info),
static Line.Info[] getSourceLineInfo(Line.Info info),
static AudioFormat.Encoding[] getTargetEncodings(AudioFormat.Encoding sourceEncoding),
static AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat),
static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat),
static Line.Info[] getTargetLineInfo(Line.Info info),
static boolean isConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat),
static boolean isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat),
static boolean isFileTypeSupported(AudioFileFormat.Type fileType),
static boolean isFileTypeSupported(AudioFileFormat.Type fileType, AudioInputStream stream)
static boolean isLineSupported(Line.Info info),
static int write(AudioInputStream stream, AudioFileFormat.Type fileType, File out),
static int write(AudioInputStream stream, AudioFileFormat.Type fileType, OutputStream out),
Unspecified NPE is thrown in the case when null object is passed in as
actual argument of the protected constructors by the following methods:
javax.sound.sampled.CompoundControl,
Control[] getMemberControls(),
String toString(),
javax.sound.sampled.EnumControl,
Object getValue(),
Object[] getValues(),
javax.sound.midi.ShortMessage:
Object clone(),
javax.sound.midi.SysexMessage:
Object clone(),
byte[] getData(),
Here is example:
------------------ example code begin --------------------------
import javax.sound.midi.MidiSystem;
public class MyExample {
public static void main(String args[]) {
try {
MidiSystem.getMidiDevice(null);
} catch (Exception e){
System.out.println("Exception: " + e);
}
}
}
------------------ example code end ----------------------------
------------------ log begin -----------------------------------
bash-2.03$ uname -a
SunOS novo101 5.8 Generic_108528-16 sun4u sparc SUNW,Ultra-1
bash-2.03$ /export/ld25/java/dest/jdk1.4.2-b11/solaris-sparc/bin/java -showversion MyExample
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b11)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b11, mixed mode)
Exception: java.lang.NullPointerException
------------------ log end -------------------------------------
======================================================================
- relates to
-
JDK-4912693 Behavior of null arguments not specified in Java Sound
- Resolved