Catching IllegalStateException