The previous fixes did not completely correct the problem scenario.
In AbstractUpdateManager.flush(), it keeps track of 2 exception collections, one as a local variable in flush() and the 2nd one maintained by the prepare statement manger. These 2 collections are combined into a single collection and returned by flush().
This approach caused the return collection not maintaining the order of exceptions took place during the flush. Typically the first exception contains the relevant information about the cause of failure and it allows the application to examine the cause and perform appropriate recovery action.