[FORWARD PORT] LPS-50619 don't use exceptions for control flow

This is a forward port of https://github.com/sergiogonzalez/liferay-plugins-ee/pull/110