Moved potentially dangerous code with encoding wrong parameters into try catch block