anismiles / websocket-android-phonegap

This is a Java library that implements Websockt API (Draft-75/76) for Android platform. Library uses java.nio.* packages for efficient non-blocking evented behavior. It easily gets integrated with Phonegap framework.
http://wp.me/pVyFz-qO
MIT License
322 stars 137 forks source link

java.lang.illegalArgument exception for nextInt #5

Open tomsiwik opened 13 years ago

tomsiwik commented 13 years ago

rarely getting error above for:

java.util.Random.nextInt() -> _randomKey():

"int position = r.nextInt(key.length() - 1) + 1;"

Sorry for the confusion, it's my first Issue i have found and posted. Greetings.

jacksun101 commented 12 years ago

Yes, this error forces my application close. Please help..

jeremycw commented 12 years ago

key.length() - 1 can be 0

r.nextInt must be given a number > 0