You'll have to define "not ok". Do you get an Exception? Does something else happen?

And if you're posting code, make sure you use the code or highlight tags to preserve formatting. The code...