This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes MIDI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "MIDI" Watch "MIDI" New topic
Author

MIDI

maya jain
Greenhorn

Joined: Feb 22, 2011
Posts: 5
Hi,

I am new to MIDI and I am trying to learn it. I am following examples from java nutshell. Here is an example, and no matter what modifications I am doing to it, I get the same error. Could you please go through this example and let me know what modifications are to be performed for getting a results
P.S: the error is Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at expiano.main(expiano.java:52)




Regards,
Maya
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

Please UseCodeTags next time. I've added them for you this time.


You potentially increase "a" by two, then use that value. But what if that makes "a" go past args.length? Even your accesses of args[a + 1] are dangerous; if someone gives only "-i" as parameters your read of a[0] ("-i") makes your code access a[1] which does not exist.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
wood burning stoves
 
subject: MIDI
 
Similar Threads
using MIDI classes: HF Java
Running Java Command LIne
Head First Java Chapter 11, example on page 346
Head First Java - Chapter 11 - MiniMusicCmdLine Error
midi player when used from commandline does not work