From: Joe E. <jo...@em...> - 2005-04-07 00:03:32
|
Around line 290 in Driver,java is the following method createPatches(): > public IPatch[] createPatches(SysexMessage[] msgs) { > byte[] sysex = MidiUtil.sysexMessagesToByteArray(msgs); > IPatch[] patarray = DriverUtil.createPatches(sysex, getDevice()); > > // Maybe you don't get the expected patch! > // Check all devices/drivers again! Call fixpatch() if > supportsPatch > // returns false. > // XXX Why don't we simply cause error? Hiroo > for (int k = 0; k < patarray.length; k++) { > ... Due to a mistake on my part, I made a driver which didn't recognize the sysex that I sent it. As a result, DriverUtil.createPatches() returned a null which was then assigned to patarray[]. This caused an exception when execution got to the patarray.length. I didn't want to mess with this, since I didn't write it and I'm not sure how it was intended to work. Granted, it was a bug in my driver which exposed this bug.... but I still think that this is a bug. It should handle this more gracefully. What's the preferred behavior here? Should Driver.createPatches check for a null patarray[], or should DriverUtil.createPatches be reworked so as to guarantee that it never returns a null? - Joe |