Validation necessary to avoid ClassCastException

You think you've found a bug? Please report it here.

Moderators: Lapo, Bax

Post Reply
davidparks21
Posts: 14
Joined: 31 Jul 2009, 07:48

Validation necessary to avoid ClassCastException

Post by davidparks21 »

I encountered the following exception because I called ExtensionHelper.createRoom(...) with a param object that contained an integer where a string was expected.

Since the param object takes Object types, validation should be done to ensure the correct type is being passed, and a more appropriate exception should be thrown.

Also, the documentation is ambiguous regarding the necessary type. In this case, the fact that a string is necessary for the "maxU" parameter should be documented in the API docs at: http://www.smartfoxserver.com/docs/docP ... index.html

Overall priority for this is pretty low as it's not impossible to troubleshoot, and virtually guaranteed to be identified in dev, but it would just makes your side of things clean and tidy.

INFO | jvm 1 | 2009/09/08 11:26:10 | java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
INFO | jvm 1 | 2009/09/08 11:26:10 | at it.gotoandplay.smartfoxserver.extensions.ExtensionHelper.createRoom(ExtensionHelper.java:460)
INFO | jvm 1 | 2009/09/08 11:26:10 | at it.gotoandplay.smartfoxserver.extensions.ExtensionHelper.createRoom(ExtensionHelper.java:357)
Post Reply