TAPESTRY-2570: Fixed NPE issue when trying to report an exception involving an instance that returns null for toString() + move around some variables definition to improve readability