It will achieve the outcome you are after but I doubt anyone would recommend that approach. It's like using a sledgehammer when an ordinary hammer would suffice. And if you were hitting some bug then you'd run into the same problem anyway.
Can you post the full stack trace? It might provide us some clues as to why you ran into the problem. Cheers!